OSDN Git Service

Fix MinGW-Bug [2119504].
authorkeithmarshall <keithmarshall>
Fri, 19 Sep 2008 22:41:01 +0000 (22:41 +0000)
committerkeithmarshall <keithmarshall>
Fri, 19 Sep 2008 22:41:01 +0000 (22:41 +0000)
winsup/mingw/ChangeLog
winsup/mingw/mingwex/getopt.c

index 983e2b2..1037598 100644 (file)
@@ -1,5 +1,15 @@
 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].
        (Reported by Peiyuan Song).
 
index 40016ad..86fc5c6 100644 (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.