Skip to content

Commit

Permalink
Check errors before using the result (#48)
Browse files Browse the repository at this point in the history
Small follow up after #47.
  • Loading branch information
tsg authored and ruflin committed Oct 11, 2016
1 parent eeb33bf commit 286c817
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sigar_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,12 +361,12 @@ func kern_procargs(pid int,
binary.Read(bbuf, binary.LittleEndian, &argc)

path, err := bbuf.ReadBytes(0)
if exe != nil {
exe(string(chop(path)))
}
if err != nil {
return fmt.Errorf("Error reading the argv[0]: %v", err)
}
if exe != nil {
exe(string(chop(path)))
}

// skip trailing \0's
for {
Expand Down

0 comments on commit 286c817

Please sign in to comment.