]> 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 18a29aa647eb6feb214a654375cde51856b86fdc..6843899d5b61e280895e20577072c98282b464f9 100644 (file)
@@ -104,8 +104,8 @@ static bool io_event_change_devpoll(int fd, short what);
 
 #ifdef IO_USE_SELECT
 #include "defines.h"   /* for conn.h */
-#include "conn.h"      /* for CONN_IDX (needed by resolve.h) */
-#include "resolve.h"   /* for RES_STAT (needed by conf.h) */
+#include "proc.h"      /* for PROC_STAT (needed by conf.h) */
+#include "conn.h"      /* for CONN_ID (needed by conf.h) */
 #include "conf.h"      /* for Conf_MaxConnections */
 
 static fd_set readers;
@@ -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)