summaryrefslogtreecommitdiff
path: root/usr.sbin/ntpd/ntpd.c
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2006-06-21 07:42:01 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2006-06-21 07:42:01 +0000
commitdb9d1e1c3fa9e2ad1bcc5f77c3e13ae23b4509a2 (patch)
tree64ae3f49d703e52fe19c906b6939108395cec05d /usr.sbin/ntpd/ntpd.c
parent8ce952b092ccda5e22707116504f050027470c9b (diff)
avoid a race by installing SIGCHLD handler before fork() is called.
ok henning@ ckuethe@
Diffstat (limited to 'usr.sbin/ntpd/ntpd.c')
-rw-r--r--usr.sbin/ntpd/ntpd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/ntpd/ntpd.c b/usr.sbin/ntpd/ntpd.c
index b2e81ac57a1..88200cdcf17 100644
--- a/usr.sbin/ntpd/ntpd.c
+++ b/usr.sbin/ntpd/ntpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntpd.c,v 1.43 2006/06/17 18:40:42 otto Exp $ */
+/* $OpenBSD: ntpd.c,v 1.44 2006/06/21 07:42:00 otto Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -137,6 +137,7 @@ main(int argc, char *argv[])
if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, pipe_chld) == -1)
fatal("socketpair");
+ signal(SIGCHLD, sighdlr);
/* fork child process */
chld_pid = ntp_main(pipe_chld, &conf);
@@ -144,7 +145,6 @@ main(int argc, char *argv[])
signal(SIGTERM, sighdlr);
signal(SIGINT, sighdlr);
- signal(SIGCHLD, sighdlr);
signal(SIGHUP, sighdlr);
close(pipe_chld[1]);