Skip to content

Commit

Permalink
Fix panic if file was deleted before os.Lstat
Browse files Browse the repository at this point in the history
  • Loading branch information
f-blass committed May 21, 2024
1 parent 211429f commit e2aa3f6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions util/configv3/load_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e2aa3f6

Please sign in to comment.