Fix missing error check of bufio.Scanner (#29882)

maybe more

(cherry picked from commit 0e183d81fc5283f9d2047472de580e4f04a046c1)
This commit is contained in:
coldWater 2024-03-19 10:20:36 +08:00 committed by Earl Warren
parent 40c9fa43cd
commit 664052fb0b
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
7 changed files with 30 additions and 0 deletions

View file

@ -50,6 +50,10 @@ func checkAuthorizedKeys(ctx context.Context, logger log.Logger, autofix bool) e
}
linesInAuthorizedKeys.Add(line)
}
err = scanner.Err()
if err != nil {
return fmt.Errorf("scan: %w", err)
}
f.Close()
// now we regenerate and check if there are any lines missing