Mercurial > hg > xemacs-beta
diff src/realpath.c @ 462:0784d089fdc9 r21-2-46
Import from CVS: tag r21-2-46
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:44:37 +0200 |
parents | 1ccc32a20af4 |
children | ed498ef2108b |
line wrap: on
line diff
--- a/src/realpath.c Mon Aug 13 11:43:25 2007 +0200 +++ b/src/realpath.c Mon Aug 13 11:44:37 2007 +0200 @@ -137,7 +137,7 @@ cygwin_readlink (const char * name, char * buf, int size) { int n = readlink (name, buf, size); - if (n < 0) + if (n < 0 && errno == EINVAL) { /* The file may exist, but isn't a symlink. Try to find the right name. */ @@ -208,6 +208,9 @@ if (abslen == 2 || abslen == 3) { strncpy (new_path, path, abslen); + /* Make sure drive letter is lowercased. */ + if (abslen == 3) + *new_path = tolower (*new_path); new_path += abslen; path += abslen; } @@ -299,7 +302,11 @@ if (n < 0) { /* EINVAL means the file exists but isn't a symlink. */ - if (errno != EINVAL) +#ifdef CYGWIN + if (errno != EINVAL && errno != ENOENT) +#else + if (errno != EINVAL) +#endif return NULL; } else @@ -345,10 +352,5 @@ /* Make sure it's null terminated. */ *new_path = '\0'; -#ifdef WIN32_NATIVE - if (ABS_LENGTH (resolved_path) == 3) - /* Lowercase drive letter. */ - *resolved_path = tolower (*resolved_path); -#endif return resolved_path; }