summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authoreban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-09-25 07:00:55 +0000
committereban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-09-25 07:00:55 +0000
commit40412b77305befcaffd0f3fcf85d6cd8f2d75f3d (patch)
tree6420115a2e8ebcd4ecd4759f6fa06b3cb844375c /win32
parent1562b35febef68ac8947a78a6eba34a83a30a0b2 (diff)
eban
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/win32/win32.c b/win32/win32.c
index f8de990bad..05b971c057 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -873,13 +873,18 @@ NtCmdGlob (NtCmdLineElement *patt)
{
ListInfo listinfo;
char buffer[MAXPATHLEN], *buf = buffer;
+ char *p, *pend, *pb;
listinfo.head = listinfo.tail = 0;
if (patt->len >= MAXPATHLEN)
buf = ruby_xmalloc(patt->len + 1);
- strncpy(buf, patt->str, patt->len);
+ p = patt->str;
+ pend = p + patt->len;
+ pb = buf;
+ for (; p < pend; p = CharNext(p))
+ *pb++ = *p == '\\' ? '/' : *p;
buf[patt->len] = 0;
rb_glob(buf, insert, (VALUE)&listinfo);
if (buf != buffer)