RootIsShared() - Fix array out of bounds error
This happened for me on the last (empty) line, but better safe than sorry so we make the check general. Upstream-commit: d478a4bb5401d7d657a2a100f98ee892a96fef2a Component: engine
This commit is contained in:
committed by
Victor Vieux
parent
ee414671bb
commit
07b0e1a559
@@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user