diff options
| author | Sean Kelly <smkelly@FreeBSD.org> | 2003-07-03 03:37:04 +0000 |
|---|---|---|
| committer | Sean Kelly <smkelly@FreeBSD.org> | 2003-07-03 03:37:04 +0000 |
| commit | bc8b08782b087804a88176fad01492ff70855b7d (patch) | |
| tree | 1950d40c387fe7125df51d651974e338cc8e11ee | |
| parent | 7af822eb30970d32de4791f9d4293ba83dd036e0 (diff) | |
Notes
| -rw-r--r-- | usr.sbin/watchdogd/Makefile | 7 | ||||
| -rw-r--r-- | usr.sbin/watchdogd/watchdogd.c | 21 |
2 files changed, 11 insertions, 17 deletions
diff --git a/usr.sbin/watchdogd/Makefile b/usr.sbin/watchdogd/Makefile index bc8bfd24d4a6..e7c5674e96dd 100644 --- a/usr.sbin/watchdogd/Makefile +++ b/usr.sbin/watchdogd/Makefile @@ -1,8 +1,7 @@ # $FreeBSD$ -PROG= watchdogd -SRCS= watchdogd.c -MAN= watchdogd.8 -WARNS= 6 +PROG= watchdogd +MAN= watchdogd.8 +WARNS= 6 .include <bsd.prog.mk> diff --git a/usr.sbin/watchdogd/watchdogd.c b/usr.sbin/watchdogd/watchdogd.c index cfee0eb6db3c..c53673435874 100644 --- a/usr.sbin/watchdogd/watchdogd.c +++ b/usr.sbin/watchdogd/watchdogd.c @@ -28,24 +28,21 @@ * Software watchdog daemon. */ -#include <sys/cdefs.h> +#include <sys/types.h> __FBSDID("$FreeBSD$"); -#include <sys/types.h> -#include <sys/errno.h> -#include <sys/sysctl.h> -#include <sys/time.h> #include <sys/rtprio.h> #include <sys/stat.h> +#include <sys/sysctl.h> +#include <sys/time.h> #include <err.h> #include <paths.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> -#include <string.h> #include <sysexits.h> #include <unistd.h> -#include <signal.h> static void parseargs(int, char *[]); static void sighandler(int); @@ -82,7 +79,7 @@ main(int argc, char *argv[]) err(EX_OSERR, "rtprio"); if (watchdog_init() == -1) - exit(EX_SOFTWARE); + errx(EX_SOFTWARE, "unable to initialize watchdog"); if (watchdog_onoff(1) == -1) exit(EX_SOFTWARE); @@ -133,8 +130,7 @@ watchdog_init() error = sysctlnametomib("debug.watchdog.reset", reset_mib, &reset_miblen); if (error == -1) { - fprintf(stderr, "Could not find reset OID: %s\n", - strerror(errno)); + warn("could not find reset OID"); return (error); } return watchdog_tickle(); @@ -189,9 +185,8 @@ watchdog_onoff(int onoff) error = sysctl(mib, len, NULL, NULL, &onoff, sizeof(onoff)); if (error == -1) { - fprintf(stderr, "Could not %s watchdog: %s\n", - (onoff > 0) ? "enable" : "disable", - strerror(errno)); + warn("could not %s watchdog", + (onoff > 0) ? "enable" : "disable"); return (error); } return (0); |
