diff options
author | H_Konishi <H_Konishi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-09-15 12:56:44 +0000 |
---|---|---|
committer | H_Konishi <H_Konishi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-09-15 12:56:44 +0000 |
commit | 6101b0afccd22ddb748d4aec446f0026d42c6f04 (patch) | |
tree | 7f3838c7ce7cf990cc94fd91e0990577f3eb7955 /win32 | |
parent | 94134139bd9b7896d5f3b5339f622e35ec1c700a (diff) |
* win32/win32.c (opendir): Corresponds to the unjust path containing ".
(win32_stat) : ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@2866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r-- | win32/win32.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/win32/win32.c b/win32/win32.c index bd3b1d65eb..088e438673 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -1311,8 +1311,8 @@ opendir(const char *filename) char scannamespc[PATHLEN]; char *scanname = scannamespc; struct stat sbuf; - WIN32_FIND_DATA FindData; - HANDLE fh; + struct _finddata_t fd; + long fh; char root[PATHLEN]; char volname[PATHLEN]; DWORD serial, maxname, flags; @@ -1351,8 +1351,8 @@ opendir(const char *filename) // do the FindFirstFile call // - fh = FindFirstFile (scanname, &FindData); - if (fh == INVALID_HANDLE_VALUE) { + fh = _findfirst(scanname, &fd); + if (fh == -1) { return NULL; } @@ -1361,9 +1361,9 @@ opendir(const char *filename) // filenames that we find. // - idx = strlen(FindData.cFileName)+1; + idx = strlen(fd.name)+1; p->start = ALLOC_N(char, idx); - strcpy (p->start, FindData.cFileName); + strcpy(p->start, fd.name); p->nfiles++; // @@ -1372,8 +1372,8 @@ opendir(const char *filename) // the variable idx should point one past the null terminator // of the previous string found. // - while (FindNextFile(fh, &FindData)) { - len = strlen (FindData.cFileName); + while (_findnext(fh, &fd) == 0) { + len = strlen(fd.name); // // bump the string table size by enough for the @@ -1386,11 +1386,11 @@ opendir(const char *filename) if (p->start == NULL) { rb_fatal ("opendir: malloc failed!\n"); } - strcpy(&p->start[idx], FindData.cFileName); + strcpy(&p->start[idx], fd.name); p->nfiles++; idx += len+1; } - FindClose(fh); + _findclose(fh); p->size = idx; p->curr = p->start; return p; @@ -2647,6 +2647,12 @@ win32_stat(const char *path, struct stat *st) *s = '\0'; len = strlen(buf1); p = CharPrev(buf1, buf1 + len); + if( '\"' == *(--s) ) + { + errno = EBADF; + return -1; + } + if (isUNCRoot(buf1)) { if (*p != '\\') strcat(buf1, "\\"); |