From e2aa3f664787b5c99989ed61cab5f04e80eead25 Mon Sep 17 00:00:00 2001 From: Felix Blass Date: Fri, 17 May 2024 23:24:24 +0200 Subject: [PATCH] Fix panic if file was deleted before os.Lstat --- util/configv3/load_config.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/util/configv3/load_config.go b/util/configv3/load_config.go index f03d3d773e1..7642da776ab 100644 --- a/util/configv3/load_config.go +++ b/util/configv3/load_config.go @@ -179,8 +179,11 @@ func removeOldTempConfigFiles() error { for _, oldTempFileName := range oldTempFileNames { fi, err := os.Lstat(oldTempFileName) - // ignore if file doesn't exist anymore due to race conditions if multiple cli commands are running in parallel - if err != nil && !errors.Is(err, os.ErrNotExist) { + if err != nil { + // ignore if file doesn't exist anymore due to race conditions if multiple cli commands are running in parallel + if errors.Is(err, os.ErrNotExist) { + continue + } return err } // only delete old orphans which are not caught by the signal handler in WriteConfig