1 From: Sven Eckelmann <sven@narfation.org>
2 Date: Sun, 1 Dec 2013 14:39:00 +0100
3 Subject: Allow one to disable forking to background in debug_mode 0
6 posix/init.c | 19 ++++++++++++++-----
7 1 file changed, 14 insertions(+), 5 deletions(-)
9 diff --git a/posix/init.c b/posix/init.c
10 index afd409f..901c65a 100644
21 @@ -159,6 +160,7 @@ void apply_init_args( int argc, char *argv[] ) {
22 {"purge-timeout", required_argument, 0, 'q'},
23 {"disable-aggregation", no_argument, 0, 'x'},
24 {"disable-client-nat", no_argument, 0, 'z'},
25 + {"no-detach", no_argument, 0, 'D'},
29 @@ -166,7 +168,7 @@ void apply_init_args( int argc, char *argv[] ) {
33 - while ( ( optchar = getopt_long( argc, argv, "a:A:bcd:hHio:g:p:r:s:vV", long_options, &option_index ) ) != -1 ) {
34 + while ( ( optchar = getopt_long( argc, argv, "a:A:bcd:hHio:g:p:r:s:vVD", long_options, &option_index ) ) != -1 ) {
38 @@ -378,6 +380,11 @@ void apply_init_args( int argc, char *argv[] ) {
50 @@ -536,12 +543,14 @@ void apply_init_args( int argc, char *argv[] ) {
52 if (debug_level == 0) {
54 - if (my_daemon() < 0) {
56 + if (my_daemon() < 0) {
58 - printf("Error - can't fork to background: %s\n", strerror(errno));
61 + printf("Error - can't fork to background: %s\n", strerror(errno));
68 openlog("batmand", LOG_PID, LOG_DAEMON);