diff --git a/src/ChangeLog b/src/ChangeLog index c383aeaa0a0..62ad09eb4c2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2014-03-10 Eli Zaretskii + + * 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 . + 2014-03-10 Martin Rudalics * w32term.c (w32_read_socket): In SIZE_RESTORED case 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) if (fd != AT_FDCWD) { - if (_snprintf (fullname, sizeof fullname, "%s/%s", dir_pathname, name) + char lastc = dir_pathname[strlen (dir_pathname) - 1]; + + if (_snprintf (fullname, sizeof fullname, "%s%s%s", + dir_pathname, IS_DIRECTORY_SEP (lastc) ? "" : "/", name) < 0) { errno = ENAMETOOLONG;