Skip to content

Commit

Permalink
modules, mountinfo: check scanner.Err after scanner.Scan
Browse files Browse the repository at this point in the history
Check for any non-EOF errors after `scanner.Scan`.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
  • Loading branch information
tklauser committed Mar 26, 2020
1 parent 5ff7c51 commit a457b0c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/modules/modules_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ func parseModulesFile(r io.Reader) ([]string, error) {
result = append(result, moduleInfoSeparated[0])
}

if err := scanner.Err(); err != nil {
return nil, err
}

return result, nil
}

Expand Down
4 changes: 4 additions & 0 deletions pkg/mountinfo/mountinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ func parseMountInfoFile(r io.Reader) ([]*MountInfo, error) {
})
}

if err := scanner.Err(); err != nil {
return nil, err
}

return result, nil
}

Expand Down

0 comments on commit a457b0c

Please sign in to comment.