bin/93145: [PATCH] 6.1-BETA1 DHCP config error

Brooks Davis brooks at one-eyed-alien.net
Fri Feb 10 12:00:24 PST 2006


The following reply was made to PR bin/93145; it has been noted by GNATS.

From: Brooks Davis <brooks at one-eyed-alien.net>
To: Ulf Lilleengen <lulf at stud.ntnu.no>
Cc: FreeBSD-gnats-submit at freebsd.org
Subject: Re: bin/93145: [PATCH] 6.1-BETA1 DHCP config error
Date: Fri, 10 Feb 2006 11:57:42 -0800

 > --- sysinstall_dhcpconfig.diff begins here ---
 > Index: network.c
 > ===================================================================
 > RCS file: /home/cvs/ncvs/src/usr.sbin/sysinstall/network.c,v
 > retrieving revision 1.51
 > diff -u -r1.51 network.c
 > --- network.c	1 Nov 2002 02:05:05 -0000	1.51
 > +++ network.c	10 Feb 2006 18:37:24 -0000
 > @@ -126,7 +126,7 @@
 >      snprintf(ifconfig, 255, "%s%s", VAR_IFCONFIG, dev->name);
 >      cp = variable_get(ifconfig);
 >      if (cp) {
 > -	if (strcmp(cp, "DHCP")) {
 > +	if (strcmp(cp, "DHCP") == NULL) {
 >  	    msgDebug("ifconfig %s %s\n", dev->name, cp);
 >  	    i = vsystem("ifconfig %s %s", dev->name, cp);
 >  	    if (i) {
 > --- sysinstall_dhcpconfig.diff ends here ---
 
 This change is wrong on two lecels.  First, comparing the output of
 strcmp to a pointer (NULL) is wrong.  Second, you only want to execute
 the block associated with this if statement when cp is not DHCP which is
 what the code does.  The bug in the code is treating strcmp's return as
 a bool.
 
 -- Brooks


More information about the freebsd-bugs mailing list