mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
pkg/idtools: fix use of bufio.Scanner.Err
The Err() method should be called after the Scan() loop,
not inside it.
Fixes: 9a3ab0358e
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
parent
5b658a0348
commit
745ed9686b
1 changed files with 2 additions and 5 deletions
|
@ -236,10 +236,6 @@ func parseSubidFile(path, username string) (ranges, error) {
|
|||
|
||||
s := bufio.NewScanner(subidFile)
|
||||
for s.Scan() {
|
||||
if err := s.Err(); err != nil {
|
||||
return rangeList, err
|
||||
}
|
||||
|
||||
text := strings.TrimSpace(s.Text())
|
||||
if text == "" || strings.HasPrefix(text, "#") {
|
||||
continue
|
||||
|
@ -260,5 +256,6 @@ func parseSubidFile(path, username string) (ranges, error) {
|
|||
rangeList = append(rangeList, subIDRange{startid, length})
|
||||
}
|
||||
}
|
||||
return rangeList, nil
|
||||
|
||||
return rangeList, s.Err()
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue