xffm changes

edscott wilson garcia edscott at imp.mx
Tue Jan 28 00:54:56 CET 2003


El lun, 27-01-2003 a las 12:23, Olivier Fourdan escribió:
> On Mon, 2003-01-27 at 18:03, edscott wilson garcia wrote:
> 
> > I'm attaching a patch with the corrections made to your last patch, and
> > as you can see the code losses simplicity and is much longer (KISS). In
> > the original code, using 256 character strings on the stack might seem
> > overkill, but it's really a tradeoff to cut out a lot of code. POSIX
> > says that paths are no more than 255, so there is really no segv
> > posibility here.
> 
> Well I did not follow your thread, but what I can say is I definitely
> prefer allocating a char* on the fly with the correct length to hold to
> path rather than using fixed array length. It could be slower on
> alloc/free, but definitely more secure. Nothing is worst than trying to
> track down strings overruns of a single (or more) bytes because it can
> very well work on some architectures and crash on other.

I must admit I used to think as you, but it's Thomas Leonard's fault
that I combine both tecniques (reading code from rox filer I noticed he
uses buffers of 4096, to hold stuff much smaller). I reason that it
probably is just as fast to use 4096 because of memory pagesize
considerations.
 
> 
> As for length of path, as far as I recall, it's 1024 or 4096, not 256,
> but this is defined in a var called PATH_MAX defined in #include
> <limits.h> on POSIX systems.

According to the freeBSD manuals, it's set by posix to 256. But of
course it would be much better plainly use PATH_MAX and that should be
fixed. 

EWG

> 
> Cheers,
> -- 
> Olivier Fourdan <fourdan at xfce.org>
> http://www.xfce.org
> 
> _______________________________________________
> Xfce4-dev mailing list
> Xfce4-dev at moongroup.com
> http://moongroup.com/mailman/listinfo/xfce4-dev
> 





More information about the Xfce4-dev mailing list