]> git.ipfire.org Git - thirdparty/libvirt.git/commit
util: reduce scope of a DIR * in virCgroupV1SetOwner()
authorLaine Stump <laine@redhat.com>
Sun, 25 Oct 2020 21:31:53 +0000 (17:31 -0400)
committerLaine Stump <laine@redhat.com>
Tue, 3 Nov 2020 03:01:36 +0000 (22:01 -0500)
commit098f03c29e0822786b8ccd8936106dc51d172193
tree8ae655009fe44ce6fc7fe772a144eaefc1aee096
parent21f659d952c687aaab08bb62c8d253157b4e1d8e
util: reduce scope of a DIR * in virCgroupV1SetOwner()

DIR *dh is being re-used each time through the for loop of this
function, so it must be closed and then re-opened, which means we
can't convert it to g_autoptr. By moving the definition of dh inside
the for loop, we make it possible to trivially convert to g_autoptr
(which will happen in a subsequent patch)

NB: VIR_DIR_CLOSE() is already called at the bottom of the for loop,
so removing the VIR_DIR_CLOSE() at the end of the function is *not*
creating a leak of a DIR*!

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
src/util/vircgroupv1.c