diff options
| author | Paul Eggert | 2011-06-23 01:10:57 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-06-23 01:10:57 -0700 |
| commit | 6dd7e40073d6f18bcb287b59256607caea17404a (patch) | |
| tree | 1524f3b6e01ea057d8b03e8c5645404120d37f28 /lib/stat.c | |
| parent | 7efb4e0e62ed3e11e20d15821342c322b4101ae7 (diff) | |
| download | emacs-6dd7e40073d6f18bcb287b59256607caea17404a.tar.gz emacs-6dd7e40073d6f18bcb287b59256607caea17404a.zip | |
* lib/getopt.c, lib/stat.c, m4/gl-comp.m4: Merge from gnulib.
Diffstat (limited to 'lib/stat.c')
| -rw-r--r-- | lib/stat.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/stat.c b/lib/stat.c index cbc9100fd4d..f07370dd06b 100644 --- a/lib/stat.c +++ b/lib/stat.c | |||
| @@ -38,6 +38,7 @@ orig_stat (const char *filename, struct stat *buf) | |||
| 38 | #include <stdbool.h> | 38 | #include <stdbool.h> |
| 39 | #include <string.h> | 39 | #include <string.h> |
| 40 | #include "dosname.h" | 40 | #include "dosname.h" |
| 41 | #include "verify.h" | ||
| 41 | 42 | ||
| 42 | /* Store information about NAME into ST. Work around bugs with | 43 | /* Store information about NAME into ST. Work around bugs with |
| 43 | trailing slashes. Mingw has other bugs (such as st_ino always | 44 | trailing slashes. Mingw has other bugs (such as st_ino always |
| @@ -63,6 +64,12 @@ rpl_stat (char const *name, struct stat *st) | |||
| 63 | } | 64 | } |
| 64 | #endif /* REPLACE_FUNC_STAT_FILE */ | 65 | #endif /* REPLACE_FUNC_STAT_FILE */ |
| 65 | #if REPLACE_FUNC_STAT_DIR | 66 | #if REPLACE_FUNC_STAT_DIR |
| 67 | /* The only known systems where REPLACE_FUNC_STAT_DIR is needed also | ||
| 68 | have a constant PATH_MAX. */ | ||
| 69 | # ifndef PATH_MAX | ||
| 70 | # error "Please port this replacement to your platform" | ||
| 71 | # endif | ||
| 72 | |||
| 66 | if (result == -1 && errno == ENOENT) | 73 | if (result == -1 && errno == ENOENT) |
| 67 | { | 74 | { |
| 68 | /* Due to mingw's oddities, there are some directories (like | 75 | /* Due to mingw's oddities, there are some directories (like |
| @@ -77,6 +84,7 @@ rpl_stat (char const *name, struct stat *st) | |||
| 77 | char fixed_name[PATH_MAX + 1] = {0}; | 84 | char fixed_name[PATH_MAX + 1] = {0}; |
| 78 | size_t len = strlen (name); | 85 | size_t len = strlen (name); |
| 79 | bool check_dir = false; | 86 | bool check_dir = false; |
| 87 | verify (PATH_MAX <= 4096); | ||
| 80 | if (PATH_MAX <= len) | 88 | if (PATH_MAX <= len) |
| 81 | errno = ENAMETOOLONG; | 89 | errno = ENAMETOOLONG; |
| 82 | else if (len) | 90 | else if (len) |