Patch by Denis Vlasenko to add forground support.
[people/mcb30/busybox.git] / patches / udhcpd_foreground.diff
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;
13 +       
14 +       while (strcmp(argv[1],"-f")==0 || strcmp(argv[1],"--foreground")==0) {
15 +               daemonize = 0;
16 +               argv++;
17 +               argc--;
18 +       }
19         
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;
25  
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. */
31  
32         /* Setup the signal pipe */
33         udhcp_sp_setup();