GNU C Library master sources branch, master, updated. glibc-2.11-337-gaa7f642

drepper@sourceware.org drepper@sourceware.org
Thu Apr 8 00:18:00 GMT 2010


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  aa7f642769abcfbce658aeaaffdc9fb4790cd905 (commit)
      from  22ef35456ea0b36e09f3241043f894eb71d2c9da (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=aa7f642769abcfbce658aeaaffdc9fb4790cd905

commit aa7f642769abcfbce658aeaaffdc9fb4790cd905
Author: Eric Blake <ebb9@byu.net>
Date:   Wed Apr 7 17:16:27 2010 -0700

    Fix -W with optional parameters in getopt.
    
    According to the getopt documentation, if "W;" is part of optstring, then '-W
    foo' should behave like '--foo'.  But if "foo" uses an optional_argument, this
    is not the case, since optarg is not NULL when using -W.

diff --git a/ChangeLog b/ChangeLog
index d59224b..e1de2df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-12-02  Eric Blake	<ebb9@byu.net>
+
+	[BZ #11041]
+	* posix/getopt.c (_getopt_internal_r): Handle '-Wfoo' identically
+	to '--foo', with optional argument or non-ambiguous prefix.
+
 2010-04-07  Ulrich Drepper  <drepper@redhat.com>
 
 	[BZ #11134]
@@ -9,7 +15,7 @@
 	if NSS_FLAG_ADJUNCT_AS_SHADOW is set.
 	(_nss_nis_getpwnam_r): Likewise.
 	(_nss_nis_getpwuid_r): Likewise.
-	* nis/nss_nis/nis-spwd.c (ent_adjunct_used): Nee global variable.
+	* nis/nss_nis/nis-spwd.c (ent_adjunct_used): New global variable.
 	(_nss_nis_setspent): Also reset ent_adjunct_used.
 	(internal_nis_getspent_r): If new_start is set and shadow.byname table
 	does not exist and NSS_FLAG_ADJUNCT_AS_SHADOW is set, try to get
diff --git a/posix/getopt.c b/posix/getopt.c
index 88acff0..01c1071 100644
--- a/posix/getopt.c
+++ b/posix/getopt.c
@@ -911,7 +911,10 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
 		  pfound = p;
 		  indfound = option_index;
 		}
-	      else
+	      else if (long_only
+		       || pfound->has_arg != p->has_arg
+		       || pfound->flag != p->flag
+		       || pfound->val != p->val)
 		/* Second or later nonexact match found.  */
 		ambig = 1;
 	    }
@@ -1028,6 +1031,8 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
 		    return optstring[0] == ':' ? ':' : '?';
 		  }
 	      }
+	    else
+	      d->optarg = NULL;
 	    d->__nextchar += strlen (d->__nextchar);
 	    if (longind != NULL)
 	      *longind = option_index;

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog      |    8 +++++++-
 posix/getopt.c |    7 ++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources



More information about the Glibc-cvs mailing list