File tree Expand file tree Collapse file tree 2 files changed +3
-6
lines changed Expand file tree Collapse file tree 2 files changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ func FindCgroup() (Cgroup, error) {
4444 fields := strings .Split (text , " " )
4545 // Safe as mountinfo encodes mountpoints with spaces as \040.
4646 index := strings .Index (text , " - " )
47- postSeparatorFields := strings .Fields (text [index + 3 :])
47+ postSeparatorFields := strings .Split (text [index + 3 :], " " )
4848 numPostFields := len (postSeparatorFields )
4949
5050 // This is an error as we can't detect if the mount is for "cgroup"
@@ -53,10 +53,7 @@ func FindCgroup() (Cgroup, error) {
5353 }
5454
5555 if postSeparatorFields [0 ] == "cgroup" {
56- // Check that the mount is properly formated.
57- if numPostFields < 3 {
58- return nil , fmt .Errorf ("Error found less than 3 fields post '-' in %q" , text )
59- }
56+ // No need to parse the rest of the postSeparatorFields
6057
6158 cg := & CgroupV1 {
6259 MountPath : filepath .Dir (fields [4 ]),
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ func parseInfoFile(r io.Reader) ([]*Info, error) {
6464 }
6565 // Safe as mountinfo encodes mountpoints with spaces as \040.
6666 index := strings .Index (text , " - " )
67- postSeparatorFields := strings .Fields (text [index + 3 :])
67+ postSeparatorFields := strings .Split (text [index + 3 :], " " )
6868 if len (postSeparatorFields ) < 3 {
6969 return nil , fmt .Errorf ("Error found less than 3 fields post '-' in %q" , text )
7070 }
You can’t perform that action at this time.
0 commit comments