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". Upstream-commit: d263aa6ca916ba9141f341447a2387e7a6316717 Component: engine
This commit is contained in:
committed by
Victor Vieux
parent
71899158fd
commit
54672e1985
@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user