cgclear -e is supposed to clear only empty groups. This works fine, but
when a non-empty group is being cleared, cgclear displays an error and
returns nozero exit code.
It should be silent and return zero exit code, because stumbling upon a
nonempty group is perfectly fine and not an error.
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
ret = rmdir(path);
if (ret == 0 || errno == ENOENT)
return 0;
- if (errno == EBUSY)
+
+ if ((flags & CGFLAG_DELETE_EMPTY_ONLY) && (errno == EBUSY))
return ECGNONEMPTY;
last_errno = errno;
for (i = cfg_files.count-1; i >= 0 ; i--) {
ret = cgroup_config_unload_config(cfg_files.items[i],
flags);
- if (ret) {
+ if (ret && ret != ECGNONEMPTY) {
report_error(ret, argv[0]);
if (!error)
error = ret;