Browse Source

More descriptive error if a signal causes the child to exit; ok henning@

OPENBSD_3_8
dtucker 19 years ago
parent
commit
98e724b50a
1 changed files with 7 additions and 4 deletions
  1. +7
    -4
      src/usr.sbin/ntpd/ntpd.c

+ 7
- 4
src/usr.sbin/ntpd/ntpd.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: ntpd.c,v 1.38 2005/06/19 17:11:13 henning Exp $ */
/* $OpenBSD: ntpd.c,v 1.39 2005/07/11 08:08:06 dtucker Exp $ */
/* /*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -217,7 +217,8 @@ main(int argc, char *argv[])
int int
check_child(pid_t pid, const char *pname) check_child(pid_t pid, const char *pname)
{ {
int status;
int status, sig;
char *signame;
if (waitpid(pid, &status, WNOHANG) > 0) { if (waitpid(pid, &status, WNOHANG) > 0) {
if (WIFEXITED(status)) { if (WIFEXITED(status)) {
@ -225,8 +226,10 @@ check_child(pid_t pid, const char *pname)
return (1); return (1);
} }
if (WIFSIGNALED(status)) { if (WIFSIGNALED(status)) {
log_warnx("Lost child: %s terminated; signal %d",
pname, WTERMSIG(status));
sig = WTERMSIG(status);
signame = strsignal(sig) ? strsignal(sig) : "unknown";
log_warnx("Lost child: %s terminated; signal %d (%s)",
pname, sig, signame);
return (1); return (1);
} }
} }


Loading…
Cancel
Save