aboutsummaryrefslogtreecommitdiff
path: root/miscutils/watchdog.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-03-26 13:20:54 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-03-26 13:20:54 +0000
commit5a142025d372ae5dff7d7cf98f442edaafd1dc30 (patch)
tree19d222f7d7040945cf92e239055dfdd00b8656bc /miscutils/watchdog.c
parentbb7fcb4229fd5ff583039f26ca1c06340e3f09ea (diff)
downloadbusybox-w32-5a142025d372ae5dff7d7cf98f442edaafd1dc30.tar.gz
busybox-w32-5a142025d372ae5dff7d7cf98f442edaafd1dc30.tar.bz2
busybox-w32-5a142025d372ae5dff7d7cf98f442edaafd1dc30.zip
move everything to new NOMMU helpers, except udhcp
Diffstat (limited to 'miscutils/watchdog.c')
-rw-r--r--miscutils/watchdog.c15
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)
29 unsigned timer_duration = 30; /* Userspace timer duration, in seconds */ 29 unsigned timer_duration = 30; /* Userspace timer duration, in seconds */
30 char *t_arg; 30 char *t_arg;
31 31
32 opt_complementary = "=1"; /* must have 1 argument */
32 opts = getopt32(argc, argv, "Ft:", &t_arg); 33 opts = getopt32(argc, argv, "Ft:", &t_arg);
33 34
34 if (opts & OPT_TIMER) 35 if (opts & OPT_TIMER)
35 timer_duration = xatou(t_arg); 36 timer_duration = xatou(t_arg);
36 37
37 /* We're only interested in the watchdog device .. */
38 if (optind < argc - 1 || argc == 1)
39 bb_show_usage();
40
41 if (!(opts & OPT_FOREGROUND)) { 38 if (!(opts & OPT_FOREGROUND)) {
42#ifdef BB_NOMMU 39 bb_daemonize_or_rexec(DAEMON_CHDIR_ROOT, argv);
43 if (!re_execed)
44 vfork_daemon_rexec(0, 1, argv);
45#else
46 xdaemon(0, 1);
47#endif
48 } 40 }
49 41
50 signal(SIGHUP, watchdog_shutdown); 42 signal(SIGHUP, watchdog_shutdown);
51 signal(SIGINT, watchdog_shutdown); 43 signal(SIGINT, watchdog_shutdown);
52 44
53 /* Use known fd # - avoid needing global 'int fd' */ 45 /* Use known fd # - avoid needing global 'int fd' */
54 dup2(xopen(argv[argc - 1], O_WRONLY), 3); 46 xmove_fd(xopen(argv[argc - 1], O_WRONLY), 3);
55 47
56 while (1) { 48 while (1) {
57 /* 49 /*
@@ -63,6 +55,5 @@ int watchdog_main(int argc, char **argv)
63 } 55 }
64 56
65 watchdog_shutdown(0); 57 watchdog_shutdown(0);
66
67 /* return EXIT_SUCCESS; */ 58 /* return EXIT_SUCCESS; */
68} 59}