Fix duplicate entries and missing entries in getCgroupMountsHelper

Signed-off-by: Jay Kamat <jaygkamat@gmail.com>
This commit is contained in:
Jay Kamat 2018-07-31 19:42:49 -07:00
parent e5a7c61f3c
commit a2faaa1317
No known key found for this signature in database
GPG Key ID: 5D2E399600F4F7B5
1 changed files with 4 additions and 2 deletions

View File

@ -155,14 +155,16 @@ func getCgroupMountsHelper(ss map[string]bool, mi io.Reader, all bool) ([]Mount,
if !known || (!all && seen) {
continue
}
ss[opt] = true
if strings.HasPrefix(opt, cgroupNamePrefix) {
opt = opt[len(cgroupNamePrefix):]
}
m.Subsystems = append(m.Subsystems, opt)
ss[opt] = true
numFound++
}
res = append(res, m)
if len(m.Subsystems) > 0 || all {
res = append(res, m)
}
}
if err := scanner.Err(); err != nil {
return nil, err