Fix race condition when listing /dev

Also replace os.IsNotExist(err) with errors.Is(err, fs.ErrNotExist)

Fixes: https://github.com/containers/podman/issues/23582

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh
2024-08-12 10:26:13 -04:00
parent 708d6c5e2b
commit d33abcdf10
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