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-Tag: v2.11.0-rc3~125 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=aa7ad01746bce973e4855951ab472ac010f19ccc;p=lttng-tools.git 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 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; }