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>
Thu, 6 Sep 2018 21:40:06 +0000 (17:40 -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.026475 seconds and 4 git commands to generate.