]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/io.c
Fix signalpipe file descriptor leak on RESTART
[ngircd-alex.git] / src / ngircd / io.c
index cb2b55a9297d9c0285f1be1a5d4db370f0fedb95..6843899d5b61e280895e20577072c98282b464f9 100644 (file)
@@ -785,6 +785,16 @@ io_setnonblock(int fd)
        return fcntl(fd, F_SETFL, flags) == 0;
 }
 
+bool
+io_setcloexec(int fd)
+{
+       int flags = fcntl(fd, F_GETFD);
+       if (flags == -1)
+               return false;
+       flags |= FD_CLOEXEC;
+
+       return fcntl(fd, F_SETFD, flags) == 0;
+}
 
 bool
 io_close(int fd)