From f3bc9b69786b16160da9c7f2650e1199e55529b6 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 45aad109a..ef169d320 100644 --- a/src/common/runas.c +++ b/src/common/runas.c @@ -1215,7 +1215,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