mirror of
https://github.com/prometheus/node_exporter.git
synced 2024-11-23 12:30:46 +01:00
fix hwmon nil ptr (#2873)
* fix hwmon nil ptr syslink maybe lost in some cases. --------- Signed-off-by: TaoGe <6657718+yowenter@users.noreply.github.com>
This commit is contained in:
parent
14949db87f
commit
fe78e7e51a
@ -446,7 +446,10 @@ func (c *hwMonCollector) Update(ch chan<- prometheus.Metric) error {
|
||||
|
||||
for _, hwDir := range hwmonFiles {
|
||||
hwmonXPathName := filepath.Join(hwmonPathName, hwDir.Name())
|
||||
fileInfo, _ := os.Lstat(hwmonXPathName)
|
||||
fileInfo, err := os.Lstat(hwmonXPathName)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
if fileInfo.Mode()&os.ModeSymlink > 0 {
|
||||
fileInfo, err = os.Stat(hwmonXPathName)
|
||||
|
Loading…
Reference in New Issue
Block a user