From d263aa6ca916ba9141f341447a2387e7a6316717 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Tue, 24 Sep 2013 14:16:11 +0200 Subject: [PATCH] RootIsShared: Fix root detection Column 4 is the mount position, column 3 will not always be "/" for the root. On one of my system its "/root". --- utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils.go b/utils.go index 44573927a1..99600d1882 100644 --- a/utils.go +++ b/utils.go @@ -197,7 +197,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 len(cols) >= 6 && cols[3] == "/" && cols[4] == "/" { + if len(cols) >= 6 && cols[4] == "/" { return strings.HasPrefix(cols[6], "shared") } }