X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Frunas.c;h=4bd356a0499f2119a227a69b324ab5248d7ba8a0;hp=debc95926e7d04fa7989ca8f62bc2b85e0e8aaf6;hb=938c57de605e65da12654a4963e466eb3ea4a85e;hpb=f726677b9b3a5a384bb96ea4ef7d6f0c4b03524f diff --git a/src/common/runas.c b/src/common/runas.c index debc95926..4bd356a04 100644 --- a/src/common/runas.c +++ b/src/common/runas.c @@ -402,11 +402,14 @@ int send_fd_to_master(struct run_as_worker *worker, enum run_as_cmd cmd, int fd) ret = -1; } + if (fd < 0) { + goto end; + } ret_close = close(fd); if (ret_close < 0) { PERROR("close"); } - +end: return ret; } @@ -466,6 +469,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"); @@ -806,7 +812,6 @@ int run_as(enum run_as_cmd cmd, struct run_as_data *data, DBG("Socket closed unexpectedly... " "Restarting the worker process"); ret = run_as_restart_worker(global_worker); - if (ret == -1) { ERR("Failed to restart worker process."); goto err;