summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-07-13 19:00:01 +0200
committerLennart Poettering <lennart@poettering.net>2010-07-13 19:00:01 +0200
commit4c633005eacdf964d22107f453ba804868f33a25 (patch)
treeb7ab6122b9f7166101791ba84fc9704801d0a964 /src/util.c
parentedb9aaa8b27adf89cc712000318b1e9cf40ea296 (diff)
cgroup: treat non-existing cgroups like empty ones, to deal with races
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/util.c b/src/util.c
index e5d845609d..519d22902a 100644
--- a/src/util.c
+++ b/src/util.c
@@ -2565,7 +2565,8 @@ static int rm_rf_children(int fd, bool only_dirs) {
if (!(d = fdopendir(fd))) {
close_nointr_nofail(fd);
- return -errno;
+
+ return errno == ENOENT ? 0 : -errno;
}
for (;;) {
@@ -2589,7 +2590,7 @@ static int rm_rf_children(int fd, bool only_dirs) {
struct stat st;
if (fstatat(fd, de->d_name, &st, AT_SYMLINK_NOFOLLOW) < 0) {
- if (ret == 0)
+ if (ret == 0 && errno != ENOENT)
ret = -errno;
continue;
}
@@ -2602,7 +2603,7 @@ static int rm_rf_children(int fd, bool only_dirs) {
int subdir_fd;
if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) {
- if (ret == 0)
+ if (ret == 0 && errno != ENOENT)
ret = -errno;
continue;
}
@@ -2613,13 +2614,13 @@ static int rm_rf_children(int fd, bool only_dirs) {
}
if (unlinkat(fd, de->d_name, AT_REMOVEDIR) < 0) {
- if (ret == 0)
+ if (ret == 0 && errno != ENOENT)
ret = -errno;
}
} else if (!only_dirs) {
if (unlinkat(fd, de->d_name, 0) < 0) {
- if (ret == 0)
+ if (ret == 0 && errno != ENOENT)
ret = -errno;
}
}