Subject: Re: pkg/33499: net/ipw: patch to fix local variable conflict with global
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Geoff Wing <gcw@pobox.com>
List: pkgsrc-bugs
Date: 05/18/2006 01:45:02
The following reply was made to PR pkg/33499; it has been noted by GNATS.

From: Geoff Wing <gcw@pobox.com>
To: NetBSD GNATS <gnats-bugs@netbsd.org>
Cc: 
Subject: Re: pkg/33499: net/ipw: patch to fix local variable conflict with global
Date: Thu, 18 May 2006 11:40:29 +1000

 On Wednesday 2006-05-17 09:40 +0000, joerg@britannica.bec.de output:
 : Not sure if I have the time to look at it, but whoever tackles this
 : problem should make sure that the local optreset is *really* meant.
  
 This doesn't really make sense to me.  If there were more references
 to it, I would have renamed them and it would be obvious in the patch.
 There's nothing else that can come along and change the value of
 optreset - I wonder if gcc optimises it out.  In fact, the whole
 optreset/my_optreset bits could be ripped out altogether - I've just
 left it in for reference.  However, looking over it again, my patch-ab
 and the patch-ac in this PR change the same file - which IIRC was not
 desirable.  So, here's a patch for the other patch.
 
 --- patches/patch-ab	2003-12-16 04:02:22.000000000 +1100
 +++ patches/patch-ab	2006-05-18 11:26:48.000000000 +1000
 @@ -1,7 +1,28 @@
  $NetBSD: patch-ab,v 1.1 2003/12/15 17:02:22 agc Exp $
  
  --- ipw.c.orig	1999-03-30 08:04:12.000000000 +0100
 -+++ ipw.c	2003-12-15 16:58:12.000000000 +0000
 ++++ ipw.c	2006-05-18 11:24:44.000000000 +1000
 +@@ -257,7 +257,7 @@
 + static int my_opterr = 1;	/* if error message should be printed */
 + static int my_optind = 1;	/* index into parent argv vector */
 + static int my_optopt;		/* character checked for validity */
 +-static int optreset;		/* reset getopt */
 ++static int my_optreset;		/* reset getopt */
 + static char *my_optarg;		/* argument associated with option */
 + 
 + #define	BADCH	(int)'?'
 +@@ -275,9 +275,9 @@
 +   static char *place = EMSG;	/* option letter processing */
 +   register char *oli = NULL;	/* option letter list index */
 + 
 +-  if (optreset || ! *place)
 ++  if (my_optreset || ! *place)
 +     {				/* update scanning pointer */
 +-      optreset = 0;
 ++      my_optreset = 0;
 +       if (my_optind >= nargc || *(place = nargv[my_optind]) != '-')
 + 	{
 + 	  place = EMSG;
  @@ -782,7 +782,7 @@
     if (!p)
       return NULL;