Merge pull request #23584 from rhatdan/error

Fix race condition when listing /dev
This commit is contained in:
openshift-merge-bot[bot] 2024-08-12 15:48:25 +00:00 committed by GitHub
commit 8f85a4da43
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View File

@ -84,7 +84,7 @@ func ParseDockerignore(containerfiles []string, root string) ([]string, string,
// does not attempts to re-resolve it
ignoreFile = path
ignore, dockerIgnoreErr = os.ReadFile(path)
if os.IsNotExist(dockerIgnoreErr) {
if errors.Is(dockerIgnoreErr, fs.ErrNotExist) {
// In this case either ignorefile was not found
// or it is a symlink to unexpected file in such
// case manually set ignorefile to `/dev/null` so

View File

@ -191,6 +191,9 @@ func getDevices(path string) ([]spec.LinuxDevice, error) {
default:
sub, err := getDevices(filepath.Join(path, f.Name()))
if err != nil {
if errors.Is(err, fs.ErrNotExist) {
continue
}
return nil, err
}
if sub != nil {
@ -209,7 +212,7 @@ func getDevices(path string) ([]spec.LinuxDevice, error) {
if err == errNotADevice {
continue
}
if os.IsNotExist(err) {
if errors.Is(err, fs.ErrNotExist) {
continue
}
return nil, err