Avoid opendir()/readdir() in closefrom() implementation
commit9ee6d2412eeca6c24cb4da33d80dbcf9986347dc
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 02:58:54 +0000 (2 15:58 +1300)
tree1c903dd061eb3a459e5544533249089b3d0176de
parentb2f0ee5e03a868283323fe687b72dfa18a061ed1
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.
xapian-core/common/closefrom.cc
xapian-core/configure.ac
xapian-core/tests/unittest.cc