Report any errors we might see when disabling the watchdog.

Complain about extra arguments so people don't get surprised
if they type "watchdog 0"
This commit is contained in:
Poul-Henning Kamp 2005-09-30 08:30:20 +00:00
parent 763a429571
commit 2a5f59b241

View File

@ -129,8 +129,7 @@ main(int argc, char *argv[])
timeout |= WD_PASSIVE; timeout |= WD_PASSIVE;
else else
timeout |= WD_ACTIVE; timeout |= WD_ACTIVE;
if (watchdog_patpat() < 0 && if (watchdog_patpat() < 0)
(timeout & WD_INTERVAL) != WD_TO_NEVER)
err(EX_OSERR, "patting the dog"); err(EX_OSERR, "patting the dog");
return (EX_OK); return (EX_OK);
} }
@ -282,6 +281,8 @@ parseargs(int argc, char *argv[])
/* NOTREACHED */ /* NOTREACHED */
} }
} }
if (argc != optind)
errx(EX_USAGE, "extra arguments.");
if (is_daemon && timeout < WD_TO_1SEC) if (is_daemon && timeout < WD_TO_1SEC)
errx(EX_USAGE, "-t argument is less than one second."); errx(EX_USAGE, "-t argument is less than one second.");
} }