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 <jsafr...@redhat.com> --- src/api.c | 3 ++- src/tools/cgclear.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/api.c b/src/api.c index 20ebf84..7233319 100644 --- a/src/api.c +++ b/src/api.c @@ -1927,7 +1927,8 @@ static int cg_delete_cgroup_controller(char *cgroup_name, char *controller, 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; diff --git a/src/tools/cgclear.c b/src/tools/cgclear.c index 1dc3e96..7580403 100644 --- a/src/tools/cgclear.c +++ b/src/tools/cgclear.c @@ -119,7 +119,7 @@ int main(int argc, char *argv[]) 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; ------------------------------------------------------------------------------ Cloud Services Checklist: Pricing and Packaging Optimization This white paper is intended to serve as a reference, checklist and point of discussion for anyone considering optimizing the pricing and packaging model of a cloud services business. Read Now! http://www.accelacomm.com/jaw/sfnl/114/51491232/ _______________________________________________ Libcg-devel mailing list Libcg-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libcg-devel