X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fcommon%2Frunas.c;h=f3adf7355444fe8a8961f1132151110b891fc4ba;hb=ef3dfe5d31c88fb548189a6441aaf8b2afc0bd4b;hp=9fe6dcd58efaaa5f4c551efa0ba5e03017837543;hpb=561f5f2c7bfe491f6a2b1254545f143901b11cd7;p=lttng-tools.git diff --git a/src/common/runas.c b/src/common/runas.c index 9fe6dcd58..f3adf7355 100644 --- a/src/common/runas.c +++ b/src/common/runas.c @@ -466,6 +466,9 @@ int cleanup_received_fd(enum run_as_cmd cmd, int fd) return 0; } + if (fd < 0) { + return 0; + } ret = close(fd); if (ret < 0) { PERROR("close error"); @@ -488,6 +491,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 @@ -919,6 +925,9 @@ int run_as_extract_elf_symbol_offset(int fd, const char* function, struct run_as_data data; struct run_as_ret ret; + memset(&data, 0, sizeof(data)); + memset(&ret, 0, sizeof(ret)); + DBG3("extract_elf_symbol_offset() on fd=%d and function=%s " "with for uid %d and gid %d", fd, function, (int) uid, (int) gid); @@ -948,6 +957,9 @@ int run_as_extract_sdt_probe_offsets(int fd, const char* provider_name, struct run_as_data data; struct run_as_ret ret; + memset(&data, 0, sizeof(data)); + memset(&ret, 0, sizeof(ret)); + DBG3("extract_sdt_probe_offsets() on fd=%d, probe_name=%s and " "provider_name=%s with for uid %d and gid %d", fd, probe_name, provider_name, (int) uid, (int) gid);