1
0
mirror of https://github.com/opencontainers/runc.git synced 2025-08-08 12:42:06 +03:00

Look for " - " instead of just - as separator

- symbol can appear in any path

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
This commit is contained in:
Alexander Morozov
2016-02-18 09:58:29 -08:00
parent 488e315c21
commit 98cbce80fb
2 changed files with 92 additions and 40 deletions

View File

@@ -126,11 +126,11 @@ func getCgroupMountsHelper(ss map[string]bool, mi io.Reader) ([]Mount, error) {
scanner := bufio.NewScanner(mi)
for scanner.Scan() {
txt := scanner.Text()
sepIdx := strings.IndexByte(txt, '-')
sepIdx := strings.Index(txt, " - ")
if sepIdx == -1 {
return nil, fmt.Errorf("invalid mountinfo format")
}
if txt[sepIdx+2:sepIdx+8] != "cgroup" {
if txt[sepIdx+3:sepIdx+9] != "cgroup" {
continue
}
fields := strings.Split(txt, " ")