diff options
| author | Eli Zaretskii | 2007-02-23 18:40:41 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2007-02-23 18:40:41 +0000 |
| commit | 22189f791fb6ea0e9e5df5dfc7436379e9a1cf14 (patch) | |
| tree | 4dbb5f7323e86ae56d82f752ac003a70bb81ee9f /src | |
| parent | 38008dcd924d42aeac69d0fa27034b80bc6687fe (diff) | |
| download | emacs-22189f791fb6ea0e9e5df5dfc7436379e9a1cf14.tar.gz emacs-22189f791fb6ea0e9e5df5dfc7436379e9a1cf14.zip | |
(stat, get_long_basename, is_unc_volume): Use _mbspbrk instead of strpbrk.
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32.c | 13 |
1 files changed, 9 insertions, 4 deletions
| @@ -32,6 +32,7 @@ Boston, MA 02110-1301, USA. | |||
| 32 | #include <sys/file.h> | 32 | #include <sys/file.h> |
| 33 | #include <sys/time.h> | 33 | #include <sys/time.h> |
| 34 | #include <sys/utime.h> | 34 | #include <sys/utime.h> |
| 35 | #include <mbstring.h> /* for _mbspbrk */ | ||
| 35 | 36 | ||
| 36 | /* must include CRT headers *before* config.h */ | 37 | /* must include CRT headers *before* config.h */ |
| 37 | 38 | ||
| @@ -739,7 +740,7 @@ get_long_basename (char * name, char * buf, int size) | |||
| 739 | int len = 0; | 740 | int len = 0; |
| 740 | 741 | ||
| 741 | /* must be valid filename, no wild cards or other invalid characters */ | 742 | /* must be valid filename, no wild cards or other invalid characters */ |
| 742 | if (strpbrk (name, "*?|<>\"")) | 743 | if (_mbspbrk (name, "*?|<>\"")) |
| 743 | return 0; | 744 | return 0; |
| 744 | 745 | ||
| 745 | dir_handle = FindFirstFile (name, &find_data); | 746 | dir_handle = FindFirstFile (name, &find_data); |
| @@ -814,7 +815,7 @@ is_unc_volume (const char *filename) | |||
| 814 | if (!IS_DIRECTORY_SEP (ptr[0]) || !IS_DIRECTORY_SEP (ptr[1]) || !ptr[2]) | 815 | if (!IS_DIRECTORY_SEP (ptr[0]) || !IS_DIRECTORY_SEP (ptr[1]) || !ptr[2]) |
| 815 | return 0; | 816 | return 0; |
| 816 | 817 | ||
| 817 | if (strpbrk (ptr + 2, "*?|<>\"\\/")) | 818 | if (_mbspbrk (ptr + 2, "*?|<>\"\\/")) |
| 818 | return 0; | 819 | return 0; |
| 819 | 820 | ||
| 820 | return 1; | 821 | return 1; |
| @@ -2386,8 +2387,12 @@ stat (const char * path, struct stat * buf) | |||
| 2386 | } | 2387 | } |
| 2387 | 2388 | ||
| 2388 | name = (char *) map_w32_filename (path, &path); | 2389 | name = (char *) map_w32_filename (path, &path); |
| 2389 | /* must be valid filename, no wild cards or other invalid characters */ | 2390 | /* Must be valid filename, no wild cards or other invalid |
| 2390 | if (strpbrk (name, "*?|<>\"")) | 2391 | characters. We use _mbspbrk to support multibyte strings that |
| 2392 | might look to strpbrk as if they included literal *, ?, and other | ||
| 2393 | characters mentioned below that are disallowed by Windows | ||
| 2394 | filesystems. */ | ||
| 2395 | if (_mbspbrk (name, "*?|<>\"")) | ||
| 2391 | { | 2396 | { |
| 2392 | errno = ENOENT; | 2397 | errno = ENOENT; |
| 2393 | return -1; | 2398 | return -1; |