From eb95dccf3c2c9b41573fea62f4358493481071f7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Thu, 6 Sep 2018 17:40:06 -0400 Subject: [PATCH] Fix runas: don't attempt close negative fd MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Galarneau --- src/common/runas.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; } -- 2.34.1