aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-09-30 23:50:48 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-09-30 23:50:48 +0000
commit96e1b38586e80a0f014038bf4fdf4689c668fbd6 (patch)
treed7f6a7866700601598cfcc006b7dcb6cb4a7c07e /networking
parentdeabacdf91c6d1c3cfcdb4cd06780807193de81d (diff)
downloadbusybox-96e1b38586e80a0f014038bf4fdf4689c668fbd6.tar.gz
introduce and use close_on_exec_on(fd). -50 bytes.
Diffstat (limited to 'networking')
-rw-r--r--networking/nc.c2
-rw-r--r--networking/udhcp/signalpipe.c8
2 files changed, 5 insertions, 5 deletions
diff --git a/networking/nc.c b/networking/nc.c
index e7bd519e0..19750e59e 100644
--- a/networking/nc.c
+++ b/networking/nc.c
@@ -113,7 +113,7 @@ int nc_main(int argc, char **argv)
lport = get_nport(&lsa->sa);
fdprintf(2, "%d\n", ntohs(lport));
}
- fcntl(sfd, F_SETFD, FD_CLOEXEC);
+ close_on_exec_on(sfd);
accept_again:
cfd = accept(sfd, NULL, 0);
if (cfd < 0)
diff --git a/networking/udhcp/signalpipe.c b/networking/udhcp/signalpipe.c
index 9c7ead965..fafd2082a 100644
--- a/networking/udhcp/signalpipe.c
+++ b/networking/udhcp/signalpipe.c
@@ -39,9 +39,9 @@ void udhcp_sp_setup(void)
{
/* was socketpair, but it needs AF_UNIX in kernel */
xpipe(signal_pipe);
- fcntl(signal_pipe[0], F_SETFD, FD_CLOEXEC);
- fcntl(signal_pipe[1], F_SETFD, FD_CLOEXEC);
- fcntl(signal_pipe[1], F_SETFL, O_NONBLOCK);
+ close_on_exec_on(signal_pipe[0]);
+ close_on_exec_on(signal_pipe[1]);
+ ndelay_on(signal_pipe[1]);
signal(SIGUSR1, signal_handler);
signal(SIGUSR2, signal_handler);
signal(SIGTERM, signal_handler);
@@ -56,7 +56,7 @@ int udhcp_sp_fd_set(fd_set *rfds, int extra_fd)
FD_ZERO(rfds);
FD_SET(signal_pipe[0], rfds);
if (extra_fd >= 0) {
- fcntl(extra_fd, F_SETFD, FD_CLOEXEC);
+ close_on_exec_on(extra_fd);
FD_SET(extra_fd, rfds);
}
return signal_pipe[0] > extra_fd ? signal_pipe[0] : extra_fd;