From 51caf50203be08ba6f15e0d72b777f036d6bee72 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 9 Dec 2013 22:21:58 +0200 Subject: [PATCH] Fixed a bug in w32-long-file-name. --- src/w32.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/w32.c b/src/w32.c index db0b4fee485..bff0e53e8c8 100644 --- a/src/w32.c +++ b/src/w32.c @@ -2154,7 +2154,16 @@ get_long_basename (char * name, char * buf, int size) could return some unrelated file name in the same directory. */ if (_mbspbrk (fname_ansi, "?")) - cstatus = filename_from_ansi (fname_ansi, fname_utf8); + { + /* Find the basename of fname_ansi. */ + char *p = strrchr (fname_ansi, '\\'); + + if (!p) + p = fname_ansi; + else + p++; + cstatus = filename_from_ansi (p, fname_utf8); + } else { dir_handle = FindFirstFileA (fname_ansi, &find_data_ansi); -- 2.39.2