Skip to content

Commit

Permalink
Merge pull request neuvector#1621 from jayhuang-suse/two
Browse files Browse the repository at this point in the history
ReadCmdLine failure: Fix golint PR error.
  • Loading branch information
jayhuang-suse authored Oct 25, 2024
2 parents f8b22d1 + 8ad53a7 commit 6f57701
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions share/system/system_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,14 +327,13 @@ func (s *SystemTools) ReadCmdLine(pid int) ([]string, error) {
defer file.Close()

scanner := bufio.NewScanner(file)
// for scanner.Scan() {
// first line only
cmds = strings.Split(string(scanner.Text()), "\x00")
for i, t := range cmds { // it guarantees the tokens aren't pinning memory.
cmds[i] = string([]byte(t))
}
// break
// }
if scanner.Scan() {
// first line only
cmds = strings.Split(string(scanner.Text()), "\x00")
for i, t := range cmds { // it guarantees the tokens aren't pinning memory.
cmds[i] = string([]byte(t))
}
}
return cmds, nil
}

Expand Down

0 comments on commit 6f57701

Please sign in to comment.