Skip to content

Commit

Permalink
RootIsShared() - Fix array out of bounds error
Browse files Browse the repository at this point in the history
This happened for me on the last (empty) line, but better safe than sorry
so we make the check general.
  • Loading branch information
alexlarsson authored and vieux committed Sep 26, 2013
1 parent c199ed2 commit d478a4b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func RootIsShared() bool {
if data, err := ioutil.ReadFile("/proc/self/mountinfo"); err == nil {
for _, line := range strings.Split(string(data), "\n") {
cols := strings.Split(line, " ")
if cols[3] == "/" && cols[4] == "/" {
if len(cols) >= 6 && cols[3] == "/" && cols[4] == "/" {
return strings.HasPrefix(cols[6], "shared")
}
}
Expand Down

0 comments on commit d478a4b

Please sign in to comment.