Version 2.02.117 -
====================================
+ set CLOEXEC flag on file descriptors originating in libdaemon
Version 2.02.116 - 30th January 2015
====================================
goto error;
}
- /* Set Close-on-exec & non-blocking */
- if (fcntl(fd, F_SETFD, 1))
- fprintf(stderr, "setting CLOEXEC on socket fd %d failed: %s\n", fd, strerror(errno));
+ /* Set non-blocking */
if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK))
fprintf(stderr, "setting O_NONBLOCK on socket fd %d failed: %s\n", fd, strerror(errno));
failed = 1;
}
+ /* Set Close-on-exec */
+ if (fcntl(s.socket_fd, F_SETFD, 1))
+ fprintf(stderr, "setting CLOEXEC on socket fd %d failed: %s\n", s.socket_fd, strerror(errno));
+
/* Signal parent, letting them know we are ready to go. */
if (!s.foreground)
kill(getppid(), SIGTERM);