Skip to content

Commit

Permalink
Turn kernel module file parsing errors into warnings instead of hard (#…
Browse files Browse the repository at this point in the history
…19)

failing errors.
  • Loading branch information
gnurizen authored Nov 18, 2024
1 parent 1bcbda5 commit f71c12c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions proc/proc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f71c12c

Please sign in to comment.