Merge pull request #1326 from shirou/feature/fix-cmdline-cutset

fix(process,linux): remove trailing multiple \x00
pull/1329/head
shirou 3 years ago committed by GitHub
commit aa3f5a5b86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -688,9 +688,9 @@ func (p *Process) fillSliceFromCmdlineWithContext(ctx context.Context) ([]string
if len(cmdline) == 0 {
return nil, nil
}
if cmdline[len(cmdline)-1] == 0 {
cmdline = cmdline[:len(cmdline)-1]
}
cmdline = bytes.TrimRight(cmdline, "\x00")
parts := bytes.Split(cmdline, []byte{0})
var strParts []string
for _, p := range parts {

Loading…
Cancel
Save