This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch, master, updated. glibc-2.11-339-g66b93be
- From: drepper at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 8 Apr 2010 00:56:47 -0000
- Subject: GNU C Library master sources branch, master, updated. glibc-2.11-339-g66b93be
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 66b93be793af309fb78d54199aed2306650079d0 (commit)
from cf0b68196c837ad591f0e7fc0f8e8a0f690b847c (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=66b93be793af309fb78d54199aed2306650079d0
commit 66b93be793af309fb78d54199aed2306650079d0
Author: Eric Blake <ebb9@byu.net>
Date: Wed Apr 7 17:56:20 2010 -0700
getopt mishandles optstring of "+:"
diff --git a/ChangeLog b/ChangeLog
index b9e162f..bb85ba9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2009-12-01 Eric Blake <ebb9@byu.net>
+ [BZ #11039]
+ * posix/getopt.c (_getopt_internal_r): Skip optional - or + before
+ checking lead byte of optstring for :.
+
[BZ #11040]
* posix/getopt.c (_getopt_internal_r): Reject '-;' as short
option, since it conflicts with "W;" optstring extension.
diff --git a/posix/getopt.c b/posix/getopt.c
index b778047..2746364 100644
--- a/posix/getopt.c
+++ b/posix/getopt.c
@@ -395,8 +395,6 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
int long_only, struct _getopt_data *d, int posixly_correct)
{
int print_errors = d->opterr;
- if (optstring[0] == ':')
- print_errors = 0;
if (argc < 1)
return -1;
@@ -411,6 +409,10 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
posixly_correct);
d->__initialized = 1;
}
+ else if (optstring[0] == '-' || optstring[0] == '+')
+ optstring++;
+ if (optstring[0] == ':')
+ print_errors = 0;
/* Test whether ARGV[optind] points to a non-option argument.
Either it does not have option syntax, or there is an environment flag
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 4 ++++
posix/getopt.c | 6 ++++--
2 files changed, 8 insertions(+), 2 deletions(-)
hooks/post-receive
--
GNU C Library master sources