diff options
author | Martin Mares <mj@ucw.cz> | 2000-05-08 21:10:36 +0200 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 2000-05-08 21:10:36 +0200 |
commit | 0bcba21e893efb9853a68b04674e4bde9da5a1b8 (patch) | |
tree | 4f524c410255abfd1d86f10a0630ff9c7a7aa10d | |
parent | 33a368ad594822239bfbaa2eab50c76171e09b9e (diff) | |
download | bird-0bcba21e893efb9853a68b04674e4bde9da5a1b8.tar bird-0bcba21e893efb9853a68b04674e4bde9da5a1b8.zip |
When not debugging, daemonize automatically.
-rw-r--r-- | sysdep/unix/main.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/sysdep/unix/main.c b/sysdep/unix/main.c index 516c4ac..242cff0 100644 --- a/sysdep/unix/main.c +++ b/sysdep/unix/main.c @@ -337,7 +337,12 @@ signal_init(void) */ static char *opt_list = "c:dD:s:"; -static int debug_flag = 1; /* FIXME: Turn off for production use */ + +#ifdef DEBUGGING +static int debug_flag = 1; +#else +static int debug_flag = 0; +#endif static void usage(void) @@ -406,6 +411,16 @@ main(int argc, char **argv) read_config(); + if (!debug_flag) + { + pid_t pid = fork(); + if (pid < 0) + die("fork: %m"); + if (!pid) + return 0; + setsid(); + } + signal_init(); cli_init_unix(); |