[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: pong2 - PATH_MAX patch for review



On 06/20/2012 05:20 AM, Barry deFreese wrote:
Hi again,

Here is a simple little patch to build pong2 (uses PATH_MAX).

Let me know if this looks sane.



Why not do this :

size = strlen(...) + 1;
filename = malloc(size);
#ifdef PATH_MAX
if (size > PATH_MAX)
    handle_error();
#endif
snprintf(filename, size, ...);

This avoids duplicating the whole "if (writer) ... else ..." thing, plus we do not check whether __GLIBC__ is defined. I think it would be more likely to be accepted upstream.

Cyril.


Reply to: