From 2cb6b3b7346a947f1d2bcc393990d468becce34d Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Wed, 11 Oct 2023 23:16:19 +0800 Subject: [PATCH] core/exec-credential: use rmdir_and_freep at one more place --- src/core/exec-credential.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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; -- 2.47.3