Account for fd inside DIR in fd leak tracking
commit0429bfd3d2939f020c59ac2fa6db591a1a94dde9
authorOlly Betts <olly@survex.com>
Sat, 21 Apr 2018 05:58:57 +0000 (21 17:58 +1200)
committerOlly Betts <olly@survex.com>
Sat, 21 Apr 2018 05:58:57 +0000 (21 17:58 +1200)
tree75400a560361bf1a4279cd9061afd398e5648d44
parentcc1f2dbbc021355105393cb8d4be11d34e924997
Account for fd inside DIR in fd leak tracking

We open /dev/fd or /proc/self/fd using opendir to find out what fds are
open, but the DIR that returns wraps an fd open on the directory which
means we see an extra fd which can confuse the tracking.  Use dirfd() to
find this fd and ignore it.  When dirfd() isn't available just disable
fd tracking (it's specified by POSIX, so it ought to be widely
supported).
xapian-core/configure.ac
xapian-core/tests/harness/fdtracker.cc
xapian-core/tests/harness/fdtracker.h