/* signalpipe.c
*
- * Signal pipe infastructure. A reliable way of delivering signals.
+ * Signal pipe infrastructure. A reliable way of delivering signals.
*
- * Russ Dill <Russ.Dill@asu.edu> Decemeber 2003
+ * Russ Dill <Russ.Dill@asu.edu> December 2003
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*/
#include <unistd.h>
+#include <fcntl.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/socket.h>
void udhcp_sp_setup(void)
{
socketpair(AF_UNIX, SOCK_STREAM, 0, signal_pipe);
+ fcntl(signal_pipe[0], F_SETFD, FD_CLOEXEC);
+ fcntl(signal_pipe[1], F_SETFD, FD_CLOEXEC);
signal(SIGUSR1, signal_handler);
signal(SIGUSR2, signal_handler);
signal(SIGTERM, signal_handler);
{
FD_ZERO(rfds);
FD_SET(signal_pipe[0], rfds);
- if (extra_fd >= 0) FD_SET(extra_fd, rfds);
+ if (extra_fd >= 0) {
+ fcntl(extra_fd, F_SETFD, FD_CLOEXEC);
+ FD_SET(extra_fd, rfds);
+ }
return signal_pipe[0] > extra_fd ? signal_pipe[0] : extra_fd;
}