From: Jérémie Galarneau Date: Thu, 23 May 2019 17:34:37 +0000 (-0400) Subject: Fix: run_as_mkdirat returns value of errno X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=commitdiff_plain;h=f3bc9b69786b16160da9c7f2650e1199e55529b6 Fix: run_as_mkdirat returns value of errno 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 --- 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; }