Date: Fri, 10 Feb 2006 20:00:22 GMT From: Brooks Davis <brooks@one-eyed-alien.net> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/93145: [PATCH] 6.1-BETA1 DHCP config error Message-ID: <200602102000.k1AK0M0G013681@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/93145; it has been noted by GNATS. From: Brooks Davis <brooks@one-eyed-alien.net> To: Ulf Lilleengen <lulf@stud.ntnu.no> Cc: FreeBSD-gnats-submit@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200602102000.k1AK0M0G013681>