Skip to content

Commit d086941

Browse files
authored
Merge pull request #39 from DataDog/will/fix-cmdline-cutset
[Process] fix cmdline cuteset
2 parents 6301733 + 68db04d commit d086941

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

process/process_linux.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build linux
12
// +build linux
23

34
package process
@@ -618,9 +619,7 @@ func (p *Process) fillSliceFromCmdline() ([]string, error) {
618619
if len(cmdline) == 0 {
619620
return nil, nil
620621
}
621-
if cmdline[len(cmdline)-1] == 0 {
622-
cmdline = cmdline[:len(cmdline)-1]
623-
}
622+
cmdline = bytes.TrimRight(cmdline, "\x00")
624623
parts := bytes.Split(cmdline, []byte{0})
625624
var strParts []string
626625
for _, p := range parts {

0 commit comments

Comments
 (0)