Fix MinGW-Bug [2119504].

This commit is contained in:
Keith Marshall 2008-09-19 22:41:01 +00:00
parent be66dbed41
commit acf5111a6f
2 changed files with 12 additions and 2 deletions

View File

@ -1,3 +1,13 @@
2008-09-19 Keith Marshall <keithmarshall@users.sourceforge.net>
Fix MinGW-Bug [2119504].
(Reported by Peiyuan Song).
* mingwex/getopt.c (getopt_resolved): Do not overwrite...
(*retindex): ...this already correctly assigned return variable...
(opt[index].val): ...with this; this should have been assigned to...
(*opt[index].flag) [opt[index].flag != NULL]: ...this instead.
2008-09-19 Keith Marshall <keithmarshall@users.sourceforge.net>
Fix MinGW-Bug [2117379].

View File

@ -283,12 +283,12 @@ struct option *opt, int index, int *retindex, const CHAR *optstring )
/* when the caller has provided a return buffer ...
*/
if( retindex != NULL )
if( opt[index].flag != NULL )
{
/* ... then we place the proper return value there,
* and return a status code of zero ...
*/
*retindex = opt[index].val;
*(opt[index].flag) = opt[index].val;
return 0;
}
/* ... otherwise, the return value becomes the status code.