]> arthur.barton.de Git - netatalk.git/commit
Fix an error where catalog search gave incomplete results
authorRalph Boehme <sloowfranklin@gmail.com>
Thu, 6 Dec 2012 08:55:53 +0000 (09:55 +0100)
committerFrank Lahm <franklahm@googlemail.com>
Wed, 12 Dec 2012 06:21:40 +0000 (07:21 +0100)
commitbfd24f14e2c97c113e42e7d50e8513cef71589ee
tree9749efc17efc501a610f9d6e1c616403ff5b4f73
parent5c57c02c64fe20765e6c2cfa3b7dff2cbcbd7f49
Fix an error where catalog search gave incomplete results

The bug was immediately solved when chaning the current implementation
of using the function dirlookup_bybath() with paths form the dirstack,
to dirlook() with dids stored in the dirstack.
Presumably something dirlookup_bybath() went wrong thus ceratain
folders weren't searched.

catsearch() used dirlookup() to lookup directories, but then it didn't
use movecwd() to cd into them, only lchdir(). This resulted in curdir
not being updated.
Then, while processing entries of directory and adding them to the
dircache, in case the dircache hit its maximum size limit, dircache
eviction would take place.
The dircache eviction will remove a fixed size number of directories
from the cache, but for every entry to be freed it will ensure that
it's nor curdir.
Unfortunately as catsearch didn't update that, the directory that
catsearch was working on was freed, which of course resulted in access
of invalid ressouces and possible crashes.
The fix is to just use movecwd() instead of lchdir()ing directly.

Fixes bug #479.
NEWS
etc/afpd/catsearch.c