dhcpd: make -S and -f actually work
This commit is contained in:
		| @@ -3676,6 +3676,7 @@ USE_FEATURE_RUN_PARTS_FANCY("\n	-l	Prints names of all matching files even when | |||||||
|        "[-fS] [configfile]" \ |        "[-fS] [configfile]" \ | ||||||
|  |  | ||||||
| #define udhcpd_full_usage \ | #define udhcpd_full_usage \ | ||||||
|  |        "DHCP server" \ | ||||||
|        "\n	-f	Stay in foreground" \ |        "\n	-f	Stay in foreground" \ | ||||||
|        "\n	-S	Log to syslog too" |        "\n	-S	Log to syslog too" | ||||||
|  |  | ||||||
|   | |||||||
| @@ -37,6 +37,7 @@ int udhcpd_main(int argc, char **argv) | |||||||
| 	struct dhcpOfferedAddr *lease, static_lease; | 	struct dhcpOfferedAddr *lease, static_lease; | ||||||
|  |  | ||||||
| 	opt = getopt32(argc, argv, "fS"); | 	opt = getopt32(argc, argv, "fS"); | ||||||
|  | 	argv += optind; | ||||||
|  |  | ||||||
| 	if (!(opt & 1)) { /* no -f */ | 	if (!(opt & 1)) { /* no -f */ | ||||||
| 		bb_daemonize_or_rexec(0, argv); | 		bb_daemonize_or_rexec(0, argv); | ||||||
| @@ -50,7 +51,7 @@ int udhcpd_main(int argc, char **argv) | |||||||
|  |  | ||||||
| 	/* Would rather not do read_config before daemonization - | 	/* Would rather not do read_config before daemonization - | ||||||
| 	 * otherwise NOMMU machines will parse config twice */ | 	 * otherwise NOMMU machines will parse config twice */ | ||||||
| 	read_config(argv[1] ? argv[1] : DHCPD_CONF_FILE); | 	read_config(argv[0] ? argv[0] : DHCPD_CONF_FILE); | ||||||
|  |  | ||||||
| 	/* Make sure fd 0,1,2 are open */ | 	/* Make sure fd 0,1,2 are open */ | ||||||
| 	bb_sanitize_stdio(); | 	bb_sanitize_stdio(); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user