[Xcb] Get rid of PATH_MAX and MAXPATHLEN
Peter Harris
pharris at opentext.com
Mon Apr 26 07:36:29 PDT 2010
On 2010-04-26 09:27, Arnaud Fontaine wrote:
> I have attached a patch to get rid of PATH_MAX and MAXPATHLEN in
> libxcb. According to POSIX, there could be no such restrictions on path
> length (and GNU Hurd does not actually define them). If nobody complains
> on the patch, I will commit it soon to the Git repository... Hope the
> patch is ok.
I like the theory. Reliance on PATH_MAX is a good way to get burnt. An
additional malloc/free at startup isn't going to hurt.
That said, there are a couple of things that could be better about the
implementation:
1) You need to check the return value of realloc.
2) Why + 1024? Magic constants should be named, at least. Something like
"#define INITIAL_SOCKNAME_SLACK 1024" would be better.
3) I don't trust that while loop. A broken getpeername/getsockname could
send us off into an infinite loop. But I'm probably just being paranoid,
so feel free to ignore this one.
Peter Harris
PS: The Hurd isn't even trying to be POSIX if it doesn't define PATH_MAX
to 256 or more in limits.h
--
Open Text Connectivity Solutions Group
Peter Harris http://connectivity.opentext.com/
Research and Development Phone: +1 905 762 6001
pharris at opentext.com Toll Free: 1 877 359 4866
More information about the Xcb
mailing list