mirror of
https://github.com/prometheus/node_exporter.git
synced 2025-02-02 08:42:31 -08: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 {
|
for _, hwDir := range hwmonFiles {
|
||||||
hwmonXPathName := filepath.Join(hwmonPathName, hwDir.Name())
|
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 {
|
if fileInfo.Mode()&os.ModeSymlink > 0 {
|
||||||
fileInfo, err = os.Stat(hwmonXPathName)
|
fileInfo, err = os.Stat(hwmonXPathName)
|
||||||
|
|
Loading…
Reference in a new issue