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 | |
| 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')
| -rw-r--r-- | lib/getopt.c | 2 | ||||
| -rw-r--r-- | lib/stat.c | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/getopt.c b/lib/getopt.c index 23510d8afec..2af8352ee9c 100644 --- a/lib/getopt.c +++ b/lib/getopt.c | |||
| @@ -829,7 +829,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | |||
| 829 | return '?'; | 829 | return '?'; |
| 830 | } | 830 | } |
| 831 | /* Convenience. Treat POSIX -W foo same as long option --foo */ | 831 | /* Convenience. Treat POSIX -W foo same as long option --foo */ |
| 832 | if (temp[0] == 'W' && temp[1] == ';') | 832 | if (temp[0] == 'W' && temp[1] == ';' && longopts) |
| 833 | { | 833 | { |
| 834 | char *nameend; | 834 | char *nameend; |
| 835 | const struct option *p; | 835 | const struct option *p; |
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) |