changeset 76098:9ad6c99cdc71

(stat, get_long_basename, is_unc_volume): Use _mbspbrk instead of strpbrk.
author Eli Zaretskii <eliz@gnu.org>
date Fri, 23 Feb 2007 18:40:41 +0000
parents 323348e2f43f
children a5085ef9cf22
files src/w32.c
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/w32.c	Fri Feb 23 17:37:28 2007 +0000
+++ b/src/w32.c	Fri Feb 23 18:40:41 2007 +0000
@@ -32,6 +32,7 @@
 #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 @@
   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 @@
   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 @@
     }
 
   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;