From 35428fb6b2d269dbfa2eec7d0739aec149bd4cc2 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 22 Oct 2011 16:24:32 +0200 Subject: Update Gnulib to v0.0-6523-gb3609c1. --- lib/pathmax.h | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) (limited to 'lib/pathmax.h') diff --git a/lib/pathmax.h b/lib/pathmax.h index 41f0ba276..4de9c344d 100644 --- a/lib/pathmax.h +++ b/lib/pathmax.h @@ -23,7 +23,22 @@ including the terminating NUL byte. PATH_MAX is not defined on systems which have no limit on filename length, - such as GNU/Hurd. */ + such as GNU/Hurd. + + This file does *not* define PATH_MAX always. Programs that use this file + can handle the GNU/Hurd case in several ways: + - Either with a package-wide handling, or with a per-file handling, + - Either through a + #ifdef PATH_MAX + or through a fallback like + #ifndef PATH_MAX + # define PATH_MAX 8192 + #endif + or through a fallback like + #ifndef PATH_MAX + # define PATH_MAX pathconf ("/", _PC_PATH_MAX) + #endif + */ # include @@ -33,11 +48,6 @@ # define _POSIX_PATH_MAX 256 # endif -# if !defined PATH_MAX && defined _PC_PATH_MAX && defined HAVE_PATHCONF -# define PATH_MAX (pathconf ("/", _PC_PATH_MAX) < 1 ? 1024 \ - : pathconf ("/", _PC_PATH_MAX)) -# endif - /* Don't include sys/param.h if it already has been. */ # if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN # include @@ -47,10 +57,6 @@ # define PATH_MAX MAXPATHLEN # endif -# ifndef PATH_MAX -# define PATH_MAX _POSIX_PATH_MAX -# endif - # ifdef __hpux /* On HP-UX, PATH_MAX designates the maximum number of bytes in a filename, *not* including the terminating NUL byte, and is set to 1023. @@ -60,4 +66,19 @@ # define PATH_MAX 1024 # endif +# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +/* The page "Naming Files, Paths, and Namespaces" on msdn.microsoft.com, + section "Maximum Path Length Limitation", + + explains that the maximum size of a filename, including the terminating + NUL byte, is 260 = 3 + 256 + 1. + This is the same value as + - FILENAME_MAX in , + - _MAX_PATH in , + - MAX_PATH in . + Undefine the original value, because mingw's gets it wrong. */ +# undef PATH_MAX +# define PATH_MAX 260 +# endif + #endif /* _PATHMAX_H */ -- cgit v1.2.3