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.12.0-rc1~821 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=3c5427016ecdb32b5d75af2112371dd22c6889d3 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; }