From 973432074646cd884564afe4e090433037fb7953 Mon Sep 17 00:00:00 2001 From: Tommy Reilly Date: Mon, 18 Nov 2024 17:15:46 -0500 Subject: [PATCH] Turn kernel module file parsing errors into warnings instead of hard (#19) failing errors. --- proc/proc.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/proc/proc.go b/proc/proc.go index 51de6125..9dfc8590 100644 --- a/proc/proc.go +++ b/proc/proc.go @@ -122,10 +122,15 @@ func GetKernelModules(modulesPath string, count++ - nFields, _ := fmt.Sscanf(line, "%s %d %d %s %s 0x%x", + nFields, err := fmt.Sscanf(line, "%s %d %d %s %s 0x%x", &name, &size, &refcount, &dependencies, &state, &address) + if err != nil { + log.Warnf("err parsing line in modules: '%s'", err) + continue + } if nFields < 6 { - return nil, fmt.Errorf("unexpected line in modules: '%s'", line) + log.Warnf("unexpected line in modules: '%s'", line) + continue } if address == 0 { continue