This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/12922] getopt dumps core
- From: "eblake at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: Thu, 7 Jul 2011 14:49:36 +0000
- Subject: [Bug libc/12922] getopt dumps core
- Auto-submitted: auto-generated
- References: <bug-12922-131@http.sourceware.org/bugzilla/>
http://sourceware.org/bugzilla/show_bug.cgi?id=12922
Eric Blake <eblake at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |
--- Comment #3 from Eric Blake <eblake at redhat dot com> 2011-07-07 14:49:29 UTC ---
(In reply to comment #2)
> I checked in a patch.
Except that your patch fails to compile with C89 compilers. Can you also check
in this?
diff --git i/posix/getopt.c w/posix/getopt.c
index 3fa5a4d..e0e5503 100644
--- i/posix/getopt.c
+++ w/posix/getopt.c
@@ -871,9 +871,6 @@ _getopt_internal_r (int argc, char *const *argv, const char
*optstring,
/* Convenience. Treat POSIX -W foo same as long option --foo */
if (temp[0] == 'W' && temp[1] == ';')
{
- if (longopts == NULL)
- goto no_longs;
-
char *nameend;
const struct option *p;
const struct option *pfound = NULL;
@@ -882,6 +879,9 @@ _getopt_internal_r (int argc, char *const *argv, const char
*optstring,
int indfound = 0;
int option_index;
+ if (longopts == NULL)
+ goto no_longs;
+
/* This is an option that requires an argument. */
if (*d->__nextchar != '\0')
{
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.