From fc19b2b9a58576577340f99ea121ef51492ab2d8 Mon Sep 17 00:00:00 2001 From: Thomas Gruber Date: Fri, 18 Aug 2023 11:27:47 +0200 Subject: [PATCH] Update likwidMetric.go Fixes a potential bug when `fsnotify.NewWatcher()` fails with an error --- collectors/likwidMetric.go | 1 + 1 file changed, 1 insertion(+) diff --git a/collectors/likwidMetric.go b/collectors/likwidMetric.go index 36abb8e..372567b 100644 --- a/collectors/likwidMetric.go +++ b/collectors/likwidMetric.go @@ -344,6 +344,7 @@ func (m *LikwidCollector) takeMeasurement(evidx int, evset LikwidEventsetConfig, watcher, err := fsnotify.NewWatcher() if err != nil { cclog.ComponentError(m.name, err.Error()) + return true, err } defer watcher.Close() if len(m.config.LockfilePath) > 0 {