udhcpd_foreground.diff 989 B

123456789101112131415161718192021222324252627282930313233
  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. memset(&server_config, 0, sizeof(struct server_config_t));
  20. read_config(argc < 2 ? DHCPD_CONF_FILE : argv[1]);
  21. @@ -99,9 +106,8 @@
  22. &server_config.server, server_config.arp) < 0)
  23. return 1;
  24. -#ifndef UDHCP_DEBUG
  25. - background(server_config.pidfile); /* hold lock during fork. */
  26. -#endif
  27. + if(daemonize)
  28. + background(server_config.pidfile); /* hold lock during fork. */
  29. /* Setup the signal pipe */
  30. udhcp_sp_setup();