popt: Reset long argument handling before iterating to next argument

From the LFS mailing list looking into why check-cmd-options fails using
the bundled popt:

poptGetNextOption, after it invokes the callback for
--define-variable=a=b (the operation of which sets the longArg local
variable), does not reset longArg to NULL.  So on the next time through
its loop (after invoking the --define-variable callback, before invoking
the --atleast-pkgconfig-version callback), on line 389 of popt.c, sets
con->os->nextArg to longArg (the old "a=b" string).  What it should do
is set nextArg to nextCharArg (the next item on the command line).  This
happens if longArg is NULL.

http://linuxfromscratch.org/pipermail/lfs-dev/2011-September/065065.html

Freedesktop #9584
This commit is contained in:
Bryan Kadzban 2011-09-04 12:59:56 -07:00 committed by Dan Nicholson
parent 5745e1ba08
commit e512071cae

View file

@ -297,6 +297,8 @@ int poptGetNextOpt(poptContext con) {
int singleDash;
while (!done) {
longArg = NULL;
while (!con->os->nextCharArg && con->os->next == con->os->argc
&& con->os > con->optionStack)
con->os--;