From 0351fbd504d344a47b6f160a6034f1ffb27f1b62 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen <corinna@vinschen.de> Date: Fri, 17 Apr 2009 14:51:44 +0000 Subject: [PATCH] * dcrt0.cc (globify): Make multibyte-aware. --- winsup/cygwin/ChangeLog | 4 ++++ winsup/cygwin/dcrt0.cc | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index b81dba3f8..d85bb0aa4 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,7 @@ +2009-04-17 Corinna Vinschen <corinna@vinschen.de> + + * dcrt0.cc (globify): Make multibyte-aware. + 2009-04-17 Corinna Vinschen <corinna@vinschen.de> * flock.cc (class inode_t): Add i_wait member and matching methods diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index 70d2650d9..eddd11479 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -229,7 +229,15 @@ globify (char *word, char **&argv, int &argc, int &argvlen) else if (s[1] == quote || s[1] == '\\') s++; *p++ = '\\'; - *p++ = *s; + size_t cnt = mbtowc (NULL, s, MB_CUR_MAX); + if (cnt <= 1 || cnt == (size_t)-1) + *p++ = *s; + else + { + --s; + while (cnt-- > 0) + *p++ = *++s; + } } if (*s == quote) p--;