mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
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".
This commit is contained in:
parent
be6fef0254
commit
0484b2c325
1 changed files with 1 additions and 1 deletions
2
utils.go
2
utils.go
|
@ -197,7 +197,7 @@ func RootIsShared() bool {
|
||||||
if data, err := ioutil.ReadFile("/proc/self/mountinfo"); err == nil {
|
if data, err := ioutil.ReadFile("/proc/self/mountinfo"); err == nil {
|
||||||
for _, line := range strings.Split(string(data), "\n") {
|
for _, line := range strings.Split(string(data), "\n") {
|
||||||
cols := strings.Split(line, " ")
|
cols := strings.Split(line, " ")
|
||||||
if len(cols) >= 6 && cols[3] == "/" && cols[4] == "/" {
|
if len(cols) >= 6 && cols[4] == "/" {
|
||||||
return strings.HasPrefix(cols[6], "shared")
|
return strings.HasPrefix(cols[6], "shared")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue