X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Frunas.c;h=317f687961d014f09b4021c644a75af94b10e941;hb=ee5fcf1db868d61138af7a96f1037f7ca51e55ef;hp=3916d6754314eadd4947b576dbcb4d98273ad861;hpb=0ef0325590ac65995f926a031e2f085531f74090;p=lttng-tools.git diff --git a/src/common/runas.c b/src/common/runas.c index 3916d6754..317f68796 100644 --- a/src/common/runas.c +++ b/src/common/runas.c @@ -488,6 +488,9 @@ int handle_one_cmd(struct run_as_worker *worker) run_as_fct cmd; uid_t prev_euid; + memset(&sendret, 0, sizeof(sendret)); + sendret.fd = -1; + /* * Stage 1: Receive run_as_data struct from the master. * The structure contains the command type and all the parameters needed for @@ -528,6 +531,8 @@ int handle_one_cmd(struct run_as_worker *worker) if (data.gid != getegid()) { ret = setegid(data.gid); if (ret < 0) { + sendret._error = true; + sendret._errno = errno; PERROR("setegid"); goto write_return; } @@ -535,6 +540,8 @@ int handle_one_cmd(struct run_as_worker *worker) if (data.uid != prev_euid) { ret = seteuid(data.uid); if (ret < 0) { + sendret._error = true; + sendret._errno = errno; PERROR("seteuid"); goto write_return; } @@ -710,6 +717,7 @@ int run_as_cmd(struct run_as_worker *worker, PERROR("Error reading response from run_as"); ret = -1; ret_value->_errno = errno; + goto end; } /*