aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32.c
diff options
context:
space:
mode:
authorEli Zaretskii2014-03-10 19:26:45 +0200
committerEli Zaretskii2014-03-10 19:26:45 +0200
commit70db0db7bf9fe648584f4e00a71c8c3b272a5d03 (patch)
treebbd76f9c98d7816bea75d90cf64f6de680699582 /src/w32.c
parent4f9700e529afe527d50ef519e9e26677765a12f8 (diff)
downloademacs-70db0db7bf9fe648584f4e00a71c8c3b272a5d03.tar.gz
emacs-70db0db7bf9fe648584f4e00a71c8c3b272a5d03.zip
Fix an obscure bug in fstatat on Windows 9X.
src/w32.c (fstatat): Don't add an extra slash if the argument ends with a slash: this fails the subsequent call to stat_worker on Windows 9X. Reported by oslsachem <oslsachem@gmail.com>.
Diffstat (limited to 'src/w32.c')
-rw-r--r--src/w32.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/w32.c b/src/w32.c
index 11fb2a72f69..e84c63d674c 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -5138,7 +5138,10 @@ fstatat (int fd, char const *name, struct stat *st, int flags)
5138 5138
5139 if (fd != AT_FDCWD) 5139 if (fd != AT_FDCWD)
5140 { 5140 {
5141 if (_snprintf (fullname, sizeof fullname, "%s/%s", dir_pathname, name) 5141 char lastc = dir_pathname[strlen (dir_pathname) - 1];
5142
5143 if (_snprintf (fullname, sizeof fullname, "%s%s%s",
5144 dir_pathname, IS_DIRECTORY_SEP (lastc) ? "" : "/", name)
5142 < 0) 5145 < 0)
5143 { 5146 {
5144 errno = ENAMETOOLONG; 5147 errno = ENAMETOOLONG;