Avoid opendir()/readdir() in closefrom() implementation
commit1f1819396f0171ec1b669f97bd674329133f5bef
authorOlly Betts <olly@survex.com>
Fri, 2 Dec 2016 02:48:31 +0000 (2 15:48 +1300)
committerOlly Betts <olly@survex.com>
Fri, 2 Dec 2016 22:15:11 +0000 (3 11:15 +1300)
treeabc087986c722949b56f36ec17cfaa834bc07513
parent7e3036cbda65ff111f1dfab6e1f9e4cedead7028
Avoid opendir()/readdir() in closefrom() implementation

These functions can call malloc(), which isn't safe to do between fork()
and exec() in a multi-threaded program, but after fork() is exactly
where you want to use closefrom().

Instead we now use getdirentries(), which isn't as portable, but is
available on both the platforms we need it on - Linux and OS X.

(cherry picked from commit 9ee6d2412eeca6c24cb4da33d80dbcf9986347dc)
xapian-core/common/closefrom.cc
xapian-core/configure.ac
xapian-core/tests/unittest.cc