diff options
author | Eli Zaretskii <eliz@gnu.org> | 2014-03-10 19:26:45 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2014-03-10 19:26:45 +0200 |
commit | 70db0db7bf9fe648584f4e00a71c8c3b272a5d03 (patch) | |
tree | bbd76f9c98d7816bea75d90cf64f6de680699582 /src | |
parent | 4f9700e529afe527d50ef519e9e26677765a12f8 (diff) | |
download | emacs-70db0db7bf9fe648584f4e00a71c8c3b272a5d03.tar.gz |
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')
-rw-r--r-- | src/ChangeLog | 6 | ||||
-rw-r--r-- | src/w32.c | 5 |
2 files changed, 10 insertions, 1 deletions
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 <eliz@gnu.org> + + * 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>. + 2014-03-10 Martin Rudalics <rudalics@gmx.at> * 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; |