cgroupv2/systemd: Properly remove intermediate directory

Signed-off-by: Ted Yu <yuzhihong@gmail.com>
This commit is contained in:
Ted Yu
2020-04-13 08:32:08 -07:00
parent ccbb3364d4
commit 614bb96676
@@ -241,6 +241,7 @@ func createCgroupsv2Path(path string) (Err error) {
}
} else {
// If the directory was created, be sure it is not left around on errors.
current := current
defer func() {
if Err != nil {
os.Remove(current)