Fix: run_as_mkdirat returns value of errno
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 23 May 2019 17:34:37 +0000 (13:34 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 5 Sep 2019 20:39:13 +0000 (16:39 -0400)
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 <jeremie.galarneau@efficios.com>
src/common/runas.c

index f1cf8eb7c64970d0992984e7bc03dcf78ac49c12..80712f7a4eb5e95c535ab4ca4e52f7dd4f905e86 100644 (file)
@@ -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;
 }
This page took 0.028537 seconds and 4 git commands to generate.