diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-03-26 17:20:54 +0400 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-03-26 17:20:54 +0400 |
commit | 5a142025d372ae5dff7d7cf98f442edaafd1dc30 (patch) | |
tree | 19d222f7d7040945cf92e239055dfdd00b8656bc /miscutils/watchdog.c | |
parent | bb7fcb4229fd5ff583039f26ca1c06340e3f09ea (diff) |
move everything to new NOMMU helpers, except udhcp
Diffstat (limited to 'miscutils/watchdog.c')
-rw-r--r-- | miscutils/watchdog.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c index e3d77d17e..28ae9bdb0 100644 --- a/miscutils/watchdog.c +++ b/miscutils/watchdog.c @@ -29,29 +29,21 @@ int watchdog_main(int argc, char **argv) unsigned timer_duration = 30; /* Userspace timer duration, in seconds */ char *t_arg; + opt_complementary = "=1"; /* must have 1 argument */ opts = getopt32(argc, argv, "Ft:", &t_arg); if (opts & OPT_TIMER) timer_duration = xatou(t_arg); - /* We're only interested in the watchdog device .. */ - if (optind < argc - 1 || argc == 1) - bb_show_usage(); - if (!(opts & OPT_FOREGROUND)) { -#ifdef BB_NOMMU - if (!re_execed) - vfork_daemon_rexec(0, 1, argv); -#else - xdaemon(0, 1); -#endif + bb_daemonize_or_rexec(DAEMON_CHDIR_ROOT, argv); } signal(SIGHUP, watchdog_shutdown); signal(SIGINT, watchdog_shutdown); /* Use known fd # - avoid needing global 'int fd' */ - dup2(xopen(argv[argc - 1], O_WRONLY), 3); + xmove_fd(xopen(argv[argc - 1], O_WRONLY), 3); while (1) { /* @@ -63,6 +55,5 @@ int watchdog_main(int argc, char **argv) } watchdog_shutdown(0); - /* return EXIT_SUCCESS; */ } |