diff options
author | avg <avg@FreeBSD.org> | 2016-11-17 15:22:55 +0000 |
---|---|---|
committer | avg <avg@FreeBSD.org> | 2016-11-17 15:22:55 +0000 |
commit | 93d8fdda36a1036fc5de8da101edaa42188a0b76 (patch) | |
tree | 4befe5f0fd23502caf4e69916c9872b8cd0b6233 /usr.sbin/watchdogd | |
parent | 71785337d916d55ed2b1a575e83623989db524ab (diff) | |
download | FreeBSD-src-93d8fdda36a1036fc5de8da101edaa42188a0b76.zip FreeBSD-src-93d8fdda36a1036fc5de8da101edaa42188a0b76.tar.gz |
Revert r308753: some unrelated changes were included into the commit
Diffstat (limited to 'usr.sbin/watchdogd')
-rw-r--r-- | usr.sbin/watchdogd/watchdogd.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/usr.sbin/watchdogd/watchdogd.c b/usr.sbin/watchdogd/watchdogd.c index 3bad9ac..c63d3cd 100644 --- a/usr.sbin/watchdogd/watchdogd.c +++ b/usr.sbin/watchdogd/watchdogd.c @@ -80,8 +80,7 @@ static u_int timeout = WD_TO_128SEC; static u_int exit_timeout = WD_TO_NEVER; static u_int pretimeout = 0; static u_int timeout_sec; -static u_int nap = 1; -static int passive = 0; +static u_int passive = 0; static int is_daemon = 0; static int is_dry_run = 0; /* do not arm the watchdog, only report on timing of the watch @@ -89,6 +88,7 @@ static int is_dry_run = 0; /* do not arm the watchdog, only static int do_timedog = 0; static int do_syslog = 1; static int fd = -1; +static int nap = 1; static int carp_thresh_seconds = -1; static char *test_cmd = NULL; @@ -685,15 +685,10 @@ seconds_to_pow2ns(int seconds) static void parseargs(int argc, char *argv[]) { - struct timespec ts; int longindex; int c; const char *lopt; - /* Get the default value of timeout_sec from the default timeout. */ - pow2ns_to_ts(timeout, &ts); - timeout_sec = ts.tv_sec; - /* * if we end with a 'd' aka 'watchdogd' then we are the daemon program, * otherwise run as a command line utility. @@ -736,9 +731,9 @@ parseargs(int argc, char *argv[]) case 't': timeout_sec = atoi(optarg); timeout = parse_timeout_to_pow2ns(c, NULL, optarg); - if (debugging) - printf("Timeout is 2^%d nanoseconds\n", - timeout); + if (debugging) + printf("Timeout is 2^%d nanoseconds\n", + timeout); break; case 'T': carp_thresh_seconds = @@ -776,9 +771,6 @@ parseargs(int argc, char *argv[]) } } - if (nap > timeout_sec / 2) - nap = timeout_sec / 2; - if (carp_thresh_seconds == -1) carp_thresh_seconds = nap; @@ -787,7 +779,10 @@ parseargs(int argc, char *argv[]) if (is_daemon && timeout < WD_TO_1SEC) errx(EX_USAGE, "-t argument is less than one second."); if (pretimeout_set) { - if (pretimeout >= timeout_sec) { + struct timespec ts; + + pow2ns_to_ts(timeout, &ts); + if (pretimeout >= (uintmax_t)ts.tv_sec) { errx(EX_USAGE, "pretimeout (%d) >= timeout (%d -> %ld)\n" "see manual section TIMEOUT RESOLUTION", |