rootless: Fix rangeUID parsing

`rangeUID` should be parsed as ids[2] rather than ids[1]

Fixes: #2173
Signed-off-by: Li Yuxuan <liyuxuan04@baidu.com>
This commit is contained in:
Li Yuxuan 2019-11-08 20:33:42 +08:00
parent 3e3e923aa2
commit 3f1a39c442
2 changed files with 2 additions and 1 deletions

View File

@ -90,7 +90,7 @@ func setRootless() error {
if err != nil {
return parseError
}
rangeUID, err := strconv.ParseUint(ids[1], 10, 0)
rangeUID, err := strconv.ParseUint(ids[2], 10, 0)
if err != nil || rangeUID == 0 {
return parseError
}

View File

@ -119,6 +119,7 @@ func TestIsRootless(t *testing.T) {
uidMap: []uidMapping{
{0, 0, 0},
{1, 0, 0},
{0, 1, 0},
{1, 1000, 0},
{1000, 1000, 0},
},