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: 0484b2c3254238a6c534f7d417c12c10b694f0d0
Component: engine
This commit is contained in:
Alexander Larsson
2013-09-24 14:16:11 +02:00
committed by Tianon Gravi
parent 1d7e574dd4
commit 8ed20571fc

View File

@ -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")
}
}