From a83c8ff2e2d64ba020376027cf3e757dde490810 Mon Sep 17 00:00:00 2001 From: smkelly Date: Thu, 3 Jul 2003 03:37:04 +0000 Subject: o style(9) fixes - Reordered #includes - Only include , not it and o style.Makefile(5) fixes - No SRCS= line when only one src file with same name as program o Use warn()/errx() instead of fprintf() - Integrated patch from Philippe Charnier Approved by: jeff (mentor) --- usr.sbin/watchdogd/Makefile | 7 +++---- usr.sbin/watchdogd/watchdogd.c | 21 ++++++++------------- 2 files changed, 11 insertions(+), 17 deletions(-) (limited to 'usr.sbin/watchdogd') diff --git a/usr.sbin/watchdogd/Makefile b/usr.sbin/watchdogd/Makefile index bc8bfd2..e7c5674 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 diff --git a/usr.sbin/watchdogd/watchdogd.c b/usr.sbin/watchdogd/watchdogd.c index cfee0eb..c536734 100644 --- a/usr.sbin/watchdogd/watchdogd.c +++ b/usr.sbin/watchdogd/watchdogd.c @@ -28,24 +28,21 @@ * Software watchdog daemon. */ -#include +#include __FBSDID("$FreeBSD$"); -#include -#include -#include -#include #include #include +#include +#include #include #include +#include #include #include -#include #include #include -#include 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); -- cgit v1.1