From 269bd3faa92aded342acb5554c9e4918dc4059d9 Mon Sep 17 00:00:00 2001 From: thediveo Date: Tue, 9 Jan 2024 19:11:02 +0100 Subject: [PATCH 1/2] fix: error logging of invalid socket-activated api paths Signed-off-by: thediveo --- socketactivator.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/socketactivator.go b/socketactivator.go index 946cdb4..881f031 100644 --- a/socketactivator.go +++ b/socketactivator.go @@ -213,19 +213,22 @@ func (s *socketActivatorProcess) activateAndWatch( // through the proc filesystem "root" element "wormholes". wormhole := "/proc/" + strconv.FormatUint(uint64(s.proc.PID), 10) + "/root" for ino, api := range apis { + if api == "" { + continue + } idx := slices.IndexFunc(s.demonDetectorPlugins, func(f *demonFinderPlugin) bool { return strings.HasSuffix(api, f.ident.APIEndpointSuffix) }) if idx < 0 { continue } - api, err := procfsroot.EvalSymlinks(api, wormhole, procfsroot.EvalFullPath) + apieval, err := procfsroot.EvalSymlinks(api, wormhole, procfsroot.EvalFullPath) if err != nil { - log.Errorf("invalid API endpoint path %s in context of %s", + log.Errorf("invalid API endpoint path '%s' in context of '%s'", api, wormhole) continue } - api = wormhole + api + api = wormhole + apieval wg.Add(1) ctx := s.contexter() go func(ino uint64, api string, enginename string, creatorfn func(apipath string, pid model.PIDType) (watcher.Watcher, error)) { From 419f1fd1ae8a52e5be8b1e8e9bac519be372a485 Mon Sep 17 00:00:00 2001 From: thediveo Date: Sat, 13 Jan 2024 20:22:01 +0100 Subject: [PATCH 2/2] fix: return error in case detector returned nil watcher Signed-off-by: thediveo --- watch.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/watch.go b/watch.go index 364b5a2..43af451 100644 --- a/watch.go +++ b/watch.go @@ -175,6 +175,10 @@ func activateAndStartWatch( if err != nil { return } + if w == nil { + err = fmt.Errorf("no '%s' watcher for API endpoint %s", enginename, apipath) + return + } remmaxwait := maxwait - time.Since(started) if remmaxwait < 0 { remmaxwait = 0