fix(process,linux): remove trailing multiple \x00

This commit is contained in:
shirou 2022-07-12 09:49:23 +00:00
parent 46f7642940
commit e2ae339eaf
1 changed files with 3 additions and 3 deletions

View File

@ -688,9 +688,9 @@ func (p *Process) fillSliceFromCmdlineWithContext(ctx context.Context) ([]string
if len(cmdline) == 0 { if len(cmdline) == 0 {
return nil, nil 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}) parts := bytes.Split(cmdline, []byte{0})
var strParts []string var strParts []string
for _, p := range parts { for _, p := range parts {