Skip to content

Commit

Permalink
Fix issue with hddtemp values not changing after startup. See #4
Browse files Browse the repository at this point in the history
  • Loading branch information
martivo committed Feb 12, 2019
1 parent 1814738 commit da6ddc4
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions sensor-exporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,15 @@ func (h *HddCollector) Init() error {
}

func (h *HddCollector) readTempsFromConn() (string, error) {
if h.conn == nil {
if err := h.Init(); err != nil {
return "", err
}
if err := h.Init(); err != nil {
return "", err
}

h.buf.Reset()
_, err := io.Copy(&h.buf, h.conn)
if err != nil {
return "", fmt.Errorf("Error reading from hddtemp socket: %v", err)
}
h.conn.Close()
return h.buf.String(), nil
}

Expand Down

0 comments on commit da6ddc4

Please sign in to comment.