Fix allocation limit for getcwd syscall
Andreas Schwab
schwab@suse.de
Fri Nov 4 22:51:00 GMT 2005
Roland McGrath <roland@redhat.com> writes:
> We have bigger problems if PATH_MAX is defined but is not actually the
> limit on the path name length as POSIX specifies. If there is a larger
> limit, that should be the PATH_MAX value. If there is no limit, then
> PATH_MAX should not be defined.
PATH_MAX only limits the length you can pass to functions taking a file
name. It does _not_ limit the length of absolute names of files in the
system. The coreutils testsuite explicitly tests for the ability to
determine the name of the cwd when it exceeds PATH_MAX.
> That said, I don't think the code should presume what the kernel
> implementation does in this regard. It should do something other than
> crash when it gets ERANGE.
PAGE_MAX has always been the limit that the kernel imposes on getcwd. It
was wrong to use PATH_MAX in the first place.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, MaxfeldstraÃe 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
More information about the Libc-hacker
mailing list