Skip to content

Commit 2673e16

Browse files
authored
Merge pull request #354 from DtxdF/temp-dir-vfs
storage: Ensure file flags are reset before removing temp dir
2 parents 455362b + f87ef64 commit 2673e16

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

storage/internal/tempdir/tempdir.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010

1111
"github.com/sirupsen/logrus"
1212
"go.podman.io/storage/internal/staging_lockfile"
13+
"go.podman.io/storage/pkg/system"
1314
)
1415

1516
/*
@@ -148,7 +149,7 @@ func RecoverStaleDirs(rootDir string) error {
148149
continue
149150
}
150151

151-
if rmErr := os.RemoveAll(tempDirPath); rmErr != nil {
152+
if rmErr := system.EnsureRemoveAll(tempDirPath); rmErr != nil {
152153
recoveryErrors = append(recoveryErrors, fmt.Errorf("error removing stale temp dir: %w", rmErr))
153154
}
154155
if unlockErr := instanceLock.UnlockAndDelete(); unlockErr != nil {
@@ -218,7 +219,7 @@ func (td *TempDir) Cleanup() error {
218219
return nil
219220
}
220221

221-
if err := os.RemoveAll(td.tempDirPath); err != nil {
222+
if err := system.EnsureRemoveAll(td.tempDirPath); err != nil {
222223
return fmt.Errorf("removing temp dir failed: %w", err)
223224
}
224225

0 commit comments

Comments
 (0)