Skip to content

Commit

Permalink
Merge pull request #5 from avagin/master
Browse files Browse the repository at this point in the history
Don't use fmt.Fscanf for /proc/sys/kernel/cap_last_cap
  • Loading branch information
syndtr committed Feb 18, 2015
2 parents 0033d5e + 0a5ea17 commit e55e583
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions capability/capability_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,15 @@ func initLastCap() error {
if err != nil {
return err
}
defer f.Close()

fmt.Fscanf(f, "%d", &capLastCap)
f.Close()
var b []byte = make([]byte, 11)
_, err = f.Read(b)
if err != nil {
return err
}

fmt.Sscanf(string(b), "%d", &capLastCap)

return nil
}
Expand Down

0 comments on commit e55e583

Please sign in to comment.