From aa7ad01746bce973e4855951ab472ac010f19ccc Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Thu, 23 May 2019 13:34:37 -0400 Subject: [PATCH] Fix: run_as_mkdirat returns value of errno MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The run_as_mkdirat() function returns the _errno value returned by the run-as worker instead of returning `ret`. This causes run_as_mkdirat() to return an error when errno was already set to a non-zero value by a previous libc/system call. Signed-off-by: Jérémie Galarneau --- src/common/runas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/runas.c b/src/common/runas.c index f1cf8eb7c..80712f7a4 100644 --- a/src/common/runas.c +++ b/src/common/runas.c @@ -1216,7 +1216,7 @@ int run_as_mkdirat(int dirfd, const char *path, mode_t mode, run_as(dirfd == AT_FDCWD ? RUN_AS_MKDIR : RUN_AS_MKDIRAT, &data, &run_as_ret, uid, gid); errno = run_as_ret._errno; - ret = run_as_ret._errno; + ret = run_as_ret.u.mkdirat.ret; error: return ret; } -- 2.34.1