Fix runas: don't attempt close negative fd
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 6 Sep 2018 21:40:06 +0000 (17:40 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 7 Sep 2018 03:26:48 +0000 (23:26 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/runas.c

index f3adf7355444fe8a8961f1132151110b891fc4ba..0a588482644f5138b138edfc39ab3002ebb48aeb 100644 (file)
@@ -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;
 }
 
This page took 0.025983 seconds and 4 git commands to generate.