If ioctl(,WDOGIOC_SMODE,) fails, kill the child process before

killing self, instead of the other way around.

Fixes a bug where the child process would use 100% CPU spinning
while it waited for its parent to arm a non-existent watchdog timer.
Now, the child process gets killed, as was intended.
This commit is contained in:
dyoung 2005-08-31 18:28:58 +00:00
parent 1c952b1b24
commit fab0410101
1 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: wdogctl.c,v 1.14 2005/08/31 18:21:39 dyoung Exp $ */
/* $NetBSD: wdogctl.c,v 1.15 2005/08/31 18:28:58 dyoung Exp $ */
/*-
* Copyright (c) 2000 Zembu Labs, Inc.
@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: wdogctl.c,v 1.14 2005/08/31 18:21:39 dyoung Exp $");
__RCSID("$NetBSD: wdogctl.c,v 1.15 2005/08/31 18:28:58 dyoung Exp $");
#endif
@ -244,8 +244,8 @@ enable_user(const char *name, u_int period)
err(EXIT_FAILURE, "unable to fork tickler process");
else if (tickler != 0) {
if (ioctl(fd, WDOGIOC_SMODE, &wm) == -1) {
err(EXIT_FAILURE, "WDOGIOC_SMODE");
(void)kill(tickler, SIGTERM);
err(EXIT_FAILURE, "WDOGIOC_SMODE");
}
(void)close(fd);
return;