diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-05-28 21:34:37 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-05-28 21:34:37 +0000 |
commit | eb2636d041e47d397416ba8378e0ed7c2e0ef81e (patch) | |
tree | 84ab49e7a88c4642ea4189e48d3ac0cd1c2b8d0d /usr.sbin/ntpd/constraint.c | |
parent | f225b1330d5cd7b32f0445be1aac4aa36a0cfc1a (diff) |
detect crashes from constraint sub-processes, instead of ignoring them.
if this happens, we want to tear down all of ntpd, so that people will
report it, any such bug can be found, and fixed.
ok bcook
Diffstat (limited to 'usr.sbin/ntpd/constraint.c')
-rw-r--r-- | usr.sbin/ntpd/constraint.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/usr.sbin/ntpd/constraint.c b/usr.sbin/ntpd/constraint.c index 2e48cf7f610..4b35a67fa2a 100644 --- a/usr.sbin/ntpd/constraint.c +++ b/usr.sbin/ntpd/constraint.c @@ -1,4 +1,4 @@ -/* $OpenBSD: constraint.c,v 1.11 2015/05/21 14:24:43 reyk Exp $ */ +/* $OpenBSD: constraint.c,v 1.12 2015/05/28 21:34:36 deraadt Exp $ */ /* * Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org> @@ -250,7 +250,7 @@ constraint_check_child(void) { struct constraint *cstr; int status; - int fail; + int fail, sig; pid_t pid; do { @@ -258,9 +258,9 @@ constraint_check_child(void) if (pid <= 0) continue; - fail = 0; + fail = sig = 0; if (WIFSIGNALED(status)) { - fail = 1; + sig = WTERMSIG(status); } else if (WIFEXITED(status)) { if (WEXITSTATUS(status) != 0) fail = 1; @@ -268,6 +268,10 @@ constraint_check_child(void) fatalx("unexpected cause of SIGCHLD"); if ((cstr = constraint_bypid(pid)) != NULL) { + if (sig) + fatalx("constraint %s, signal %d", + log_sockaddr((struct sockaddr *) + &cstr->addr->ss), sig); if (fail) { log_debug("no constraint reply from %s" " received in time, next query %ds", |