diff options
| author | Paul Eggert | 2019-06-25 15:54:37 -0700 |
|---|---|---|
| committer | Paul Eggert | 2019-06-25 15:56:58 -0700 |
| commit | 824f78418783ee0af1c804b0decb037a13a4365e (patch) | |
| tree | 7a4127256fa1117b609b1d5c50c8490b391708e1 /src | |
| parent | 7dcefa7a2bb4d2531d23cbf51eb98ce7727b366c (diff) | |
| download | emacs-824f78418783ee0af1c804b0decb037a13a4365e.tar.gz emacs-824f78418783ee0af1c804b0decb037a13a4365e.zip | |
Prefer PATH_MAX to MAXPATHLEN
PATH_MAX is standardized, MAXPATHLEN is not.
Also, the Gnulib pathmax module fixes some rare bugs with PATH_MAX.
So prefer PATH_MAX to MAXPATHLEN unless we know the latter is
also correct (for some platform-specific code).
* admin/merge-gnulib (GNULIB_MODULES): Add pathmax.
This module was already present, as a dependency of canonicalize-lgpl,
but now Emacs is using it directly. Sort.
* lib-src/emacsclient.c: Include stdint.h, pathmax.h.
(get_current_dir_name): Sync to current src/sysdep.c.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* src/sysdep.c: Include pathmax.h.
(get_current_dir_name_or_unreachable):
Use PATH_MAX instead of MAXPATHLEN.
Diffstat (limited to 'src')
| -rw-r--r-- | src/sysdep.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/sysdep.c b/src/sysdep.c index b702bae5818..f7fc99f147f 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -30,6 +30,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 30 | #include <unistd.h> | 30 | #include <unistd.h> |
| 31 | 31 | ||
| 32 | #include <c-ctype.h> | 32 | #include <c-ctype.h> |
| 33 | #include <pathmax.h> | ||
| 33 | #include <utimens.h> | 34 | #include <utimens.h> |
| 34 | 35 | ||
| 35 | #include "lisp.h" | 36 | #include "lisp.h" |
| @@ -262,10 +263,10 @@ get_current_dir_name_or_unreachable (void) | |||
| 262 | ptrdiff_t dirsize_max = min (PTRDIFF_MAX, SIZE_MAX) - 1; | 263 | ptrdiff_t dirsize_max = min (PTRDIFF_MAX, SIZE_MAX) - 1; |
| 263 | 264 | ||
| 264 | /* The maximum size of a buffer for a file name, including the | 265 | /* The maximum size of a buffer for a file name, including the |
| 265 | terminating NUL. This is bounded by MAXPATHLEN, if available. */ | 266 | terminating NUL. This is bounded by PATH_MAX, if available. */ |
| 266 | ptrdiff_t bufsize_max = dirsize_max; | 267 | ptrdiff_t bufsize_max = dirsize_max; |
| 267 | #ifdef MAXPATHLEN | 268 | #ifdef PATH_MAX |
| 268 | bufsize_max = min (bufsize_max, MAXPATHLEN); | 269 | bufsize_max = min (bufsize_max, PATH_MAX); |
| 269 | #endif | 270 | #endif |
| 270 | 271 | ||
| 271 | # if HAVE_GET_CURRENT_DIR_NAME && !BROKEN_GET_CURRENT_DIR_NAME | 272 | # if HAVE_GET_CURRENT_DIR_NAME && !BROKEN_GET_CURRENT_DIR_NAME |