"Either mount or namespace keyword has to be specified in the configuration file",
"This kernel does not support this feature",
"Value setting does not succeed",
+ "Failed to remove a non-empty group",
};
static const char const *cgroup_ignored_tasks_files[] = { "tasks", NULL };
return ECGROUPSUBSYSNOTMOUNTED;
ret = rmdir(path);
- if (ret != 0 && errno != ENOENT) {
- last_errno = errno;
- return ECGOTHER;
- }
+ if (ret == 0 || errno == ENOENT)
+ return 0;
+ if (errno == EBUSY)
+ return ECGNONEMPTY;
- return 0;
+ last_errno = errno;
+ return ECGOTHER;
}
/**
* the group from all of them.
*/
if (ret != 0 && first_error == 0) {
- first_errno = last_errno;
- first_error = ret;
+ /*
+ * ECGNONEMPTY is more or less not an error, but an
+ * indication that something was not removed.
+ * Therefore it should be replaced by any other error.
+ */
+ if (ret != ECGNONEMPTY || first_error == ECGNONEMPTY) {
+ first_errno = last_errno;
+ first_error = ret;
+ }
}
}