Glenn L McGrath | bd5d84d | 2004-03-05 13:11:05 +0000 | [diff] [blame] | 1 | Index: ./networking/udhcp/dhcpd.c |
| 2 | =================================================================== |
| 3 | RCS file: /var/cvs/busybox/networking/udhcp/dhcpd.c,v |
| 4 | retrieving revision 1.5 |
| 5 | diff -u -r1.5 dhcpd.c |
| 6 | --- a/./networking/udhcp/dhcpd.c 30 Jan 2004 23:45:12 -0000 1.5 |
| 7 | +++ b/./networking/udhcp/dhcpd.c 5 Mar 2004 13:09:05 -0000 |
| 8 | @@ -70,6 +70,13 @@ |
| 9 | struct dhcpOfferedAddr *lease; |
| 10 | int max_sock; |
| 11 | unsigned long num_ips; |
| 12 | + int daemonize = 1; |
Eric Andersen | c7bda1c | 2004-03-15 08:29:22 +0000 | [diff] [blame] | 13 | + |
Glenn L McGrath | bd5d84d | 2004-03-05 13:11:05 +0000 | [diff] [blame] | 14 | + while (strcmp(argv[1],"-f")==0 || strcmp(argv[1],"--foreground")==0) { |
| 15 | + daemonize = 0; |
| 16 | + argv++; |
| 17 | + argc--; |
| 18 | + } |
Eric Andersen | c7bda1c | 2004-03-15 08:29:22 +0000 | [diff] [blame] | 19 | |
Glenn L McGrath | bd5d84d | 2004-03-05 13:11:05 +0000 | [diff] [blame] | 20 | memset(&server_config, 0, sizeof(struct server_config_t)); |
| 21 | read_config(argc < 2 ? DHCPD_CONF_FILE : argv[1]); |
| 22 | @@ -99,9 +106,8 @@ |
| 23 | &server_config.server, server_config.arp) < 0) |
| 24 | return 1; |
Eric Andersen | c7bda1c | 2004-03-15 08:29:22 +0000 | [diff] [blame] | 25 | |
Glenn L McGrath | bd5d84d | 2004-03-05 13:11:05 +0000 | [diff] [blame] | 26 | -#ifndef UDHCP_DEBUG |
| 27 | - background(server_config.pidfile); /* hold lock during fork. */ |
| 28 | -#endif |
| 29 | + if(daemonize) |
| 30 | + background(server_config.pidfile); /* hold lock during fork. */ |
Eric Andersen | c7bda1c | 2004-03-15 08:29:22 +0000 | [diff] [blame] | 31 | |
Glenn L McGrath | bd5d84d | 2004-03-05 13:11:05 +0000 | [diff] [blame] | 32 | /* Setup the signal pipe */ |
| 33 | udhcp_sp_setup(); |