Date: Thu, 1 Mar 2001 14:51:42 -0600 From: "Jacques A. Vidrine" <n@nectar.com> To: Warner Losh <imp@harmony.village.org> Cc: Garrett Wollman <wollman@khavrinen.lcs.mit.edu>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/usr.bin/make arch.c main.c Message-ID: <20010301145142.A20573@hamlet.nectar.com> In-Reply-To: <200103011817.f21IHZd50132@harmony.village.org>; from imp@harmony.village.org on Thu, Mar 01, 2001 at 11:17:35AM -0700 References: <200103011743.MAA01724@khavrinen.lcs.mit.edu> <200103010603.f2163IM00616@freefall.freebsd.org> <200103011743.MAA01724@khavrinen.lcs.mit.edu> <200103011817.f21IHZd50132@harmony.village.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Mar 01, 2001 at 11:17:35AM -0700, Warner Losh wrote: > In message <200103011743.MAA01724@khavrinen.lcs.mit.edu> Garrett Wollman writes: > : <<On Wed, 28 Feb 2001 22:03:18 -0800 (PST), Warner Losh <imp@FreeBSD.org> said: > : > : > MAXPATHLEN includes the trailing NUL. > : > : Should have also changed the code to use PATH_MAX instead of > : MAXPATHLEN. > > OK. Can you give me a pointer to the definition of PATH_MAX in a > standards doc so I do it right? ISO/IEC 9945-1:1996 (POSIX.1) sections 2.8.2, 2.8.5, and tables 2.3, 2.6 give us this: {_POSIX_PATH_MAX} ``The number of bytes in a pathname.'' Must be defined as 255 in <limits.h>. We have this already. {PATH_MAX} ``Maximum number of bytes in a pathname (not a string length; count excludes a terminating null).'' Must be at least {_POSIX_PATH_MAX} if defined in <limits.h>. We have this already (via syslimits.h). On some systems, {PATH_MAX} may not be defined in <limits.h>, in which case you either have to assume {_POSIX_PATH_MAX} or use pathconf() to find the ``real'' value. This is to support the case where the maximum path length can vary from one filesystem to another, for example. Note that {PATH_MAX} _does not_ include a terminating null, and that in sys/param.h we define MAXPATHLEN = PATH_MAX. A quick look through the sources reveals lots & lots of `bugs' due to this. Hope this helps. Cheers, -- Jacques Vidrine / n@nectar.com / jvidrine@verio.net / nectar@FreeBSD.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010301145142.A20573>