[Xcb] Get rid of PATH_MAX and MAXPATHLEN

Arnaud Fontaine arnaud at andesi.org
Mon Apr 26 08:05:12 PDT 2010


Hi,

Thanks much for the quick reply/review.

    >  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.

Definitely.

    > 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.

Fixed.

    >   2)  Why   +  1024?   Magic   constants  should   be  named,   at
    > least. Something  like "#define INITIAL_SOCKNAME_SLACK 1024" would
    > be better.

Good idea, thanks. Fixed.

    > 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.

I  also thought  about that  when  writing the  code but  I did  nothing
because I assume  that it will never happen. What  do other people think
about that?

I  have attached to  this email  a diff  to the  previous patch  and the
complete patch.

Cheers,
--
Arnaud Fontaine (arnau)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: libxcb_fix_PATH_MAX-diff-with-previous-patch.patch
Type: text/x-diff
Size: 1727 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/xcb/attachments/20100426/28f0de65/attachment-0002.patch>


More information about the Xcb mailing list