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

Re: pong2 - PATH_MAX patch for review



On 6/20/2012 8:13 AM, Cyril Roelandt wrote:
> 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.
> 
> 
Cyril,

Thanks but what are you doing there if you overrun the size of filename (not that they are handling
it now either but PATH_MAX is fairly large).

Thanks again,

Barry


Reply to: