[PATCH] FIX vfs_recycle.c seg fault

Andrew Bartlett abartlet at samba.org
Tue Apr 8 06:24:08 GMT 2003


On Tue, Apr 08, 2003 at 07:16:27AM +0200, Stefan (metze) Metzmacher wrote:
> At 07:11 08.04.2003 +0200, Jelmer Vernooij wrote:
> >-----BEGIN PGP SIGNED MESSAGE-----
> >Hash: SHA1
> >
> >On Tuesday 08 April 2003 00:48, Simo wrote:
> > > On Mon, 2003-04-07 at 20:27, Stefan Metzmacher wrote:
> > > > At 20:16 07.04.2003 +0200, Jelmer Vernooij wrote:
> > > > >-----BEGIN PGP SIGNED MESSAGE-----
> > > > >Hash: SHA1
> > > > >
> > > > >On Monday 07 April 2003 18:57, Stefan (metze) Metzmacher wrote:
> > > > > > HI all,
> > > > > >
> > > > > > here's a small patch with prevends vfs_recycle.c from segfaulting
> > > > > > when 'keep dir tree  = True'
> > > > > >
> > > > > > and fixes the prototype of unlink_internal to get a pstring instead
> > > > > > of char *
> > > > >
> > > > >Why use a seperate malloc and not just a pstring there as well?
> > > > I would also preferr this too, but I don't want the code too much.
> > > NO, please! Keep using malloced buffers in new code if possible.
> >I'm fine with both, but the current code does malloc(PATH_MAX). Replace that
> >with either a 'real' pstring or do a 'real' malloc.
> 
> here we need a PATH_MAX buffer or we need realloc when we cat more chars at 
> the end of the malloced buffer.

realloc or asprintf() and free() are still better than a pstring.

There is a very nice talloc_asprintf() out there, and even a reallocing version
I think.

Many of the parts of this module work well with strdup().  I did some work
on this (but never tested, so never commited) and it is possible to clean it
up. 

Make sure HEAD and 3.0 are synced up for this...

Andrew Bartlett


More information about the samba-technical mailing list