]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
api.c: Fix erroneous error handling in cgroup_set_values_recursive() 23/head
authorTom Hromatka <tom.hromatka@oracle.com>
Tue, 23 Feb 2021 20:47:38 +0000 (13:47 -0700)
committerTom Hromatka <tom.hromatka@oracle.com>
Thu, 25 Feb 2021 15:14:09 +0000 (08:14 -0700)
Ignore the positive length returned by asprintf() and only act
upon the error code returned from cg_set_control_value().  Previously
cgroup_set_values_recursive() mishandled the error handling when
the value's dirty flag was set.

Reported-by: Bharani viswas <bharani.viswas@gmail.com>
Fixes: 092e4aeb0416f ("api.c: Refactor duplicate logic in cgroup modify and create")
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
src/api.c

index 11855be233146f3602101c223962236d6e2c2480..51f9075f75954594a0aabd1c0a7216509d0cf828 100644 (file)
--- a/src/api.c
+++ b/src/api.c
@@ -1913,13 +1913,7 @@ STATIC int cgroup_set_values_recursive(const char * const base,
                free(path);
                path = NULL;
 
-               /* don't consider error in files directly written by
-                * the user as fatal */
-               if (ret && !controller->values[j]->dirty) {
-                       ret = 0;
-                       continue;
-               }
-               if (ret)
+               if (error)
                        goto err;
 
                controller->values[j]->dirty = false;