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, 25 Jul 2019 19:45:26 +0000 (15:45 -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 45aad109a00904804a009e285a8bb829f115add9..ef169d3207903367d6e38e9625b656b210f98d02 100644 (file)
@@ -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;
 }
This page took 0.025587 seconds and 4 git commands to generate.