]> git.eshelyaron.com Git - emacs.git/commitdiff
(stat, get_long_basename, is_unc_volume): Use _mbspbrk instead of strpbrk.
authorEli Zaretskii <eliz@gnu.org>
Fri, 23 Feb 2007 18:40:41 +0000 (18:40 +0000)
committerEli Zaretskii <eliz@gnu.org>
Fri, 23 Feb 2007 18:40:41 +0000 (18:40 +0000)
src/w32.c

index 87ae9d9f8fdb9ef934b0d17ba3b1e6e6513fa853..9ad82c7a231aa0ecbb6d9f46396f4c749314ae4d 100644 (file)
--- a/src/w32.c
+++ b/src/w32.c
@@ -32,6 +32,7 @@ Boston, MA 02110-1301, USA.
 #include <sys/file.h>
 #include <sys/time.h>
 #include <sys/utime.h>
+#include <mbstring.h>  /* for _mbspbrk */
 
 /* must include CRT headers *before* config.h */
 
@@ -739,7 +740,7 @@ get_long_basename (char * name, char * buf, int size)
   int len = 0;
 
   /* must be valid filename, no wild cards or other invalid characters */
-  if (strpbrk (name, "*?|<>\""))
+  if (_mbspbrk (name, "*?|<>\""))
     return 0;
 
   dir_handle = FindFirstFile (name, &find_data);
@@ -814,7 +815,7 @@ is_unc_volume (const char *filename)
   if (!IS_DIRECTORY_SEP (ptr[0]) || !IS_DIRECTORY_SEP (ptr[1]) || !ptr[2])
     return 0;
 
-  if (strpbrk (ptr + 2, "*?|<>\"\\/"))
+  if (_mbspbrk (ptr + 2, "*?|<>\"\\/"))
     return 0;
 
   return 1;
@@ -2386,8 +2387,12 @@ stat (const char * path, struct stat * buf)
     }
 
   name = (char *) map_w32_filename (path, &path);
-  /* must be valid filename, no wild cards or other invalid characters */
-  if (strpbrk (name, "*?|<>\""))
+  /* Must be valid filename, no wild cards or other invalid
+     characters.  We use _mbspbrk to support multibyte strings that
+     might look to strpbrk as if they included literal *, ?, and other
+     characters mentioned below that are disallowed by Windows
+     filesystems.  */
+  if (_mbspbrk (name, "*?|<>\""))
     {
       errno = ENOENT;
       return -1;