From 25d66d97d21308f932f682bb1f3a50f28f5f0441 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Mon, 12 Aug 2024 11:12:54 -0400 Subject: [PATCH] Additional potential race condition on os.Readdir Signed-off-by: Daniel J Walsh --- libpod/lock/file/file_lock.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libpod/lock/file/file_lock.go b/libpod/lock/file/file_lock.go index 6e7dda5459..67dd35a3a4 100644 --- a/libpod/lock/file/file_lock.go +++ b/libpod/lock/file/file_lock.go @@ -1,7 +1,9 @@ package file import ( + "errors" "fmt" + "io/fs" "os" "path/filepath" "strconv" @@ -138,7 +140,9 @@ func (locks *FileLocks) DeallocateAllLocks() error { p := filepath.Join(locks.lockPath, f.Name()) err := os.Remove(p) if err != nil { - lastErr = err + if errors.Is(err, fs.ErrNotExist) { + continue + } logrus.Errorf("Deallocating lock %s", p) } }