OSDN Git Service

Correct quoted backslash handling, per bug [#2328].
authorJason Hood <jadoxa@yahoo.com.au>
Wed, 25 Jan 2017 13:41:43 +0000 (13:41 +0000)
committerJason Hood <jadoxa@yahoo.com.au>
Wed, 25 Jan 2017 13:41:43 +0000 (13:41 +0000)
mingwrt/ChangeLog
mingwrt/setargv.c

index d827abc..aed25b8 100644 (file)
@@ -1,3 +1,10 @@
+2017-01-25  Jason Hood  <jadoxa@yahoo.com.au>
+
+       Correct quoted backslash handling, per bug [#2328].
+
+       * setargv.c (__mingw32_setargv): Within single quotes, backslashes
+       should be interpreted literally; copy them as-is.
+
 2017-01-25  Keith Marshall  <keithmarshall@users.sourceforge.net>
 
        Use C99 blanks as default argv separators, per issue [#2329].
index 73bb8dd..36aaab7 100644 (file)
@@ -123,12 +123,18 @@ void __mingw32_setargv( const char *cmdline )
        * need special handling.
        */
       case '\\':
-       /* We don't (yet) know if this is a literal backslash,
-        * (directory separator), or an escape for a following
-        * quote character; just note its presence, until we
-        * have looked far enough ahead to decide.
-        */
-       ++bslash;
+       if( quoted == '\'' )
+         /* Backslashes within single quotes are always literal.
+          */
+         *argptr++ = '\\';
+
+       else
+         /* We don't (yet) know if this is a literal backslash,
+          * (directory separator), or an escape for a following
+          * quote character; just note its presence, until we
+          * have looked far enough ahead to decide.
+          */
+         ++bslash;
        break;
 
       case '[':