Subject: bin/14935: Dhclient -nw does not work, it gives usage
To: None <gnats-bugs@gnats.netbsd.org>
From: None <kivinen@ssh.fi>
List: netbsd-bugs
Date: 12/12/2001 01:27:55
>Number:         14935
>Category:       bin
>Synopsis:       Dhclient -nw does not work, it gives usage
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 13 08:34:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Tero Kivinen
>Release:        NetBSD 1.5Y
>Organization:
SSH Communications Security
>Environment:
System: NetBSD kaakeli.ssh.fi 1.5Y NetBSD 1.5Y (KAAKELI) #47: Wed Oct 31 02:45:43 EET 2001 kivinen@kaakeli.acr.fi:/usr/src/sys/arch/i386/compile/KAAKELI i386
Architecture: i386
Machine: i386
>Description:

	Dhclinet -nw gives usage instead working as described in the
	man page. This same bug is present also in netbsd 1.5.2.

>How-To-Repeat:

	run dhclient -nw and it gives you usage. The reason is that
	-nw (and -e options) are checked after checking that if the
	first character of the option is - and printing of usage.

>Fix:

--- /u/kivinen/Tmp/emacs_backups/,usr,src,dist,dhcp,client,dhclient.c.~0001~	Fri Aug  3 07:07:03 2001
+++ dhclient.c	Sun Dec  9 10:08:19 2001
@@ -198,8 +198,6 @@
 		} else if (!strcmp (argv [i], "-w")) {
 			/* do not exit if there are no broadcast interfaces. */
 			persist = 1;
- 		} else if (argv [i][0] == '-') {
- 		    usage ();
 		} else if (!strcmp (argv [i], "-e")) {
 			struct string_list *tmp;
 			if (++i == argc)
@@ -216,6 +214,8 @@
 			exit (0);
 		} else if (!strcmp (argv [i], "-nw")) {
 			nowait = 1;
+ 		} else if (argv [i][0] == '-') {
+ 		    usage ();
  		} else {
  		    struct interface_info *tmp = (struct interface_info *)0;
 		    status = interface_allocate (&tmp, MDL);
>Release-Note:
>Audit-Trail:
>Unformatted: