]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
api.c: add ret value fix in cgroup_change_cgroup_flags()
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Wed, 13 Jul 2022 19:43:23 +0000 (13:43 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Wed, 13 Jul 2022 19:43:26 +0000 (13:43 -0600)
commitae96348967a82fcd18527cb150ac6f7235fb0777
tree6bcc25b848ae3fa9554c016aeeba28dcba944b22
parentd2e2c7510d47d544b662cf6be2b4b5932491a046
api.c: add ret value fix in cgroup_change_cgroup_flags()

Fix the unused ret value warning, reported by Coverity:

CID 258304 (#1 of 1): Unused value (UNUSED_VALUE)returned_value:
Assigning value from cgroup_create_template_group(newdest, tmp, flags)
to ret here, but that stored value is overwritten before it can be used.

It turns out that cgroup_change_cgroup_flags(), calls the function
cgroup_create_template_group() to a cgroup based on a template, which
may fail and we don't check the return value for the error.  This fix
adds the check and bails out on error.

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
(cherry picked from commit c46591c5cf0d85b551668d98b33c86a68853b3d1)
src/api.c