summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/dcrt0.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/dcrt0.cc')
-rw-r--r--winsup/cygwin/dcrt0.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index e20bfc21f..4e8ff9cf9 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -312,19 +312,18 @@ quoted (char *cmd, int winshell)
return p;
}
+ const char *s = quote == '\'' ? "'" : "\\\"";
/* This must have been run from a Windows shell, so preserve
quotes for globify to play with later. */
- while (*++cmd)
- if ((p = strpbrk (cmd, "\\\"")) == NULL)
+ while (*cmd && *++cmd)
+ if ((p = strpbrk (cmd, s)) == NULL)
{
cmd = strchr (cmd, '\0'); // no closing quote
break;
}
- else if (quote == '\'')
- continue;
else if (*p == '\\')
cmd = ++p;
- else if (p[1] == quote)
+ else if (quote == '"' && p[1] == '"')
{
*p = '\\';
cmd = ++p; // a quoted quote