Skip to content

Commit

Permalink
store: remove redundant code
Browse files Browse the repository at this point in the history
EnsureRemoveAll already implements the trivial rm -rf attempt first,
so there is no need to try it before calling EnsureRemoveAll.

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Sep 27, 2023
1 parent 70f801f commit c985295
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions store.go
Original file line number Diff line number Diff line change
Expand Up @@ -2672,21 +2672,11 @@ func (s *store) DeleteContainer(id string) error {

wg.Go(func() error {
gcpath := filepath.Join(s.GraphRoot(), middleDir, container.ID)
// attempt a simple rm -rf first
if err := os.RemoveAll(gcpath); err == nil {
return nil
}
// and if it fails get to the more complicated cleanup
return system.EnsureRemoveAll(gcpath)
})

wg.Go(func() error {
rcpath := filepath.Join(s.RunRoot(), middleDir, container.ID)
// attempt a simple rm -rf first
if err := os.RemoveAll(rcpath); err == nil {
return nil
}
// and if it fails get to the more complicated cleanup
return system.EnsureRemoveAll(rcpath)
})

Expand Down

0 comments on commit c985295

Please sign in to comment.