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

Re: diff: plug telldir/seekdir leaks and more



On Friday 24 March 2006 04:15, Otto Moerbeek wrote:
> Hi,
>
> This is a revised version of the diff Paul Thorn
> <pthorn-obsd_(_at_)_styx2002_(_dot_)_no-ip_(_dot_)_org> send some time ago. It's a mix of
> Paul's diff, FreeBSD code and my own:
>
> - plug a huge leak that occurs if telldir() is called, but no
> corresponding seekdir(). Samba is suffering from that.
> - Use a data structure local to DIR to store the telldir data. FreeBSD
> uses a linked list, I chose to use an array, which avoids allocating
> lots of small chunks, the index becomes implicit as well, so we can
> drop a field from the struct.
> - Make sure that loc = telldir(); .... seekdir(loc); telldir() returns loc,
> as POSIX requires. This is an area that can be improved, since it now
> scans the array.
>
> Note that one documented behaviour is changed. POSIX does not require
> it, and most other Unix-like system do not give that guarantee.
>
> Please review and test, especially on setup that uses telldir and
> seekdir. AFAIK, no program in base does that, but at least samba
> does.
>
> 	-Otto

>From the little testing I have done, this works.  However, my users have
never had problems in the 2+ years I've had an OpenBSD samba box.
But this hasn't introduced any problems.  I plan on testing it much more
this weekend/next week.

--STeve Andre'



Visit your host, monkey.org