From: Mike Yuan Date: Wed, 11 Oct 2023 15:16:19 +0000 (+0800) Subject: core/exec-credential: use rmdir_and_freep at one more place X-Git-Tag: v255-rc1~268 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2cb6b3b7346a947f1d2bcc393990d468becce34d;p=thirdparty%2Fsystemd.git core/exec-credential: use rmdir_and_freep at one more place --- diff --git a/src/core/exec-credential.c b/src/core/exec-credential.c index 4d4dadca90d..ff2d795c7d9 100644 --- a/src/core/exec-credential.c +++ b/src/core/exec-credential.c @@ -932,7 +932,8 @@ int exec_setup_credentials( r = safe_fork("(sd-mkdcreds)", FORK_DEATHSIG|FORK_WAIT|FORK_NEW_MOUNTNS, NULL); if (r < 0) { - _cleanup_free_ char *t = NULL, *u = NULL; + _cleanup_(rmdir_and_freep) char *u = NULL; /* remove the temporary workspace if we can */ + _cleanup_free_ char *t = NULL; /* If this is not a privilege or support issue then propagate the error */ if (!ERRNO_IS_NOT_SUPPORTED(r) && !ERRNO_IS_PRIVILEGE(r)) @@ -967,9 +968,6 @@ int exec_setup_credentials( false, /* it's OK to fall back to a plain directory if we can't mount anything */ uid, gid); - - (void) rmdir(u); /* remove the workspace again if we can. */ - if (r < 0) return r;