Skip to content

Commit

Permalink
cgroups/fs2/Destroy: use Remove, ignore ENOENT
Browse files Browse the repository at this point in the history
1. There is no need to try removing it recursively.

2. Do not treat ENOENT as an error (similar to fs
   and systemd v1 drivers).

Signed-off-by: Kir Kolyshkin <[email protected]>
  • Loading branch information
kolyshkin committed Apr 19, 2020
1 parent 992d5ca commit ab276b1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libcontainer/cgroups/fs2/fs2.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ func (m *manager) Freeze(state configs.FreezerState) error {
}

func (m *manager) Destroy() error {
return os.RemoveAll(m.dirPath)
if err := os.Remove(m.dirPath); err != nil && !os.IsNotExist(err) {
return err
}
return nil
}

// GetPaths is for compatibility purpose and should be removed in future
Expand Down

0 comments on commit ab276b1

Please sign in to comment.