move everything to new NOMMU helpers, except udhcp
diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c
index e3d77d1..28ae9bd 100644
--- a/miscutils/watchdog.c
+++ b/miscutils/watchdog.c
@@ -29,29 +29,21 @@
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 @@
}
watchdog_shutdown(0);
-
/* return EXIT_SUCCESS; */
}