Fix slash escaping in cwrapper.c
authorTamar Christina <tamar@zhox.com>
Tue, 6 Jun 2017 15:16:32 +0000 (16:16 +0100)
committerTamar Christina <tamar@zhox.com>
Thu, 8 Jun 2017 06:15:26 +0000 (07:15 +0100)
Summary: Escape `\` in paths on Windows in `cwapper.c` when we re-output the paths.

Test Plan: ./validate

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #13666

Differential Revision: https://phabricator.haskell.org/D3628

driver/utils/cwrapper.c

index da6cec4..5a30274 100644 (file)
@@ -59,7 +59,7 @@ char *flattenAndQuoteArgs(char *ptr, int argc, char *argv[])
         *ptr++ = '"';
         src = argv[i];
         while(*src) {
-            if (*src == '"') {
+            if (*src == '"' || *src == '\\') {
                 *ptr++ = '\\';
             }
             *ptr++ = *src++;