diff options
author | 2011-06-17 18:12:05 +0000 | |
---|---|---|
committer | 2011-06-17 18:12:05 +0000 | |
commit | 42cf566e31ac497e8c2f04375ae7cc54af703675 (patch) | |
tree | ce430e8f2580ed760a46cda3c34f9efc1591ccc2 | |
parent | don't leak fds in failure path (ie when hosts are down) (diff) | |
download | wireguard-openbsd-42cf566e31ac497e8c2f04375ae7cc54af703675.tar.xz wireguard-openbsd-42cf566e31ac497e8c2f04375ae7cc54af703675.zip |
close pipe_prnt[0] earlier, foremost before forking the dns process
pointed out by Running Razor <runningrazor at web dot de>
-rw-r--r-- | usr.sbin/ntpd/ntp.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/ntpd/ntp.c b/usr.sbin/ntpd/ntp.c index c02cf8dc269..f4c6c88c6d6 100644 --- a/usr.sbin/ntpd/ntp.c +++ b/usr.sbin/ntpd/ntp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntp.c,v 1.115 2011/06/16 11:46:55 henning Exp $ */ +/* $OpenBSD: ntp.c,v 1.116 2011/06/17 18:12:05 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -110,6 +110,7 @@ ntp_main(int pipe_prnt[2], struct ntpd_conf *nconf, struct passwd *pw) fatal(NULL); hotplugfd = sensor_hotplugfd(); + close(pipe_prnt[0]); if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, pipe_dns) == -1) fatal("socketpair"); dns_pid = ntp_dns(pipe_dns, nconf, pw); @@ -150,7 +151,6 @@ ntp_main(int pipe_prnt[2], struct ntpd_conf *nconf, struct passwd *pw) signal(SIGHUP, SIG_IGN); signal(SIGCHLD, SIG_DFL); - close(pipe_prnt[0]); if ((ibuf_main = malloc(sizeof(struct imsgbuf))) == NULL) fatal(NULL); imsg_init(ibuf_main, pipe_prnt[1]); |