From: Jérémie Galarneau Date: Thu, 6 Sep 2018 21:40:06 +0000 (-0400) Subject: Fix runas: don't attempt close negative fd X-Git-Tag: v2.11.0-rc2~234 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=eb95dccf3c2c9b41573fea62f4358493481071f7;p=lttng-tools.git Fix runas: don't attempt close negative fd Signed-off-by: Jérémie Galarneau --- diff --git a/src/common/runas.c b/src/common/runas.c index f3adf7355..0a5884826 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; }