From 3f974165a75daf8bb0b6c992c764621265f60709 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 17 May 2008 14:54:07 +0000 Subject: * file.c (file_expand_path): fix for short file name on Cygwin. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_5@16450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- file.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'file.c') diff --git a/file.c b/file.c index 103fca2b17..9153283689 100644 --- a/file.c +++ b/file.c @@ -2732,15 +2732,20 @@ file_expand_path(fname, dname, result) RSTRING(result)->len = buflen; *p = '\0'; #if USE_NTFS - if (!strpbrk(b = buf, "*?")) { + if (1 && +#ifdef __CYGWIN__ + !(buf[0] == '/' && !buf[1]) && +#endif + !strpbrk(b = buf, "*?")) { size_t len; WIN32_FIND_DATA wfd; #ifdef __CYGWIN__ - int lnk_added = 0; + int lnk_added = 0, is_symlink = 0; struct stat st; char w32buf[MAXPATHLEN], sep = 0; p = 0; if (lstat(buf, &st) == 0 && S_ISLNK(st.st_mode)) { + is_symlink = 1; p = strrdirsep(buf); if (!p) p = skipprefix(buf); if (p) { @@ -2753,8 +2758,7 @@ file_expand_path(fname, dname, result) } if (p) *p = sep; else p = buf; - if (b == w32buf) { - strlcat(w32buf, p, sizeof(w32buf)); + if (is_symlink && b == w32buf) { len = strlen(p); if (len > 4 && strcasecmp(p + len - 4, ".lnk") != 0) { lnk_added = 1; -- cgit v1.2.3