utils: Don't use directory enumerator to close open FDs in closefrom()
authorTobias Brunner <tobias@strongswan.org>
Tue, 4 Aug 2015 12:43:26 +0000 (14:43 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 17 Aug 2015 09:19:32 +0000 (11:19 +0200)
commitb410d7f8ff39001a3fefa5bebd08de3c295f5c9c
treed64ec3546ca3ae632de2db70691b1afbaa3c9694
parentcec1fe8c7d426cadb892730ec338cd5d3107d780
utils: Don't use directory enumerator to close open FDs in closefrom()

Calling malloc() after fork() is potentially unsafe, so we should avoid
it if possible.  opendir() will still require an allocation but that's
less than the variant using the enumerator wrapper, thus, decreasing
the conflict potential.  This way we can also avoid closing the
FD for the enumerated directory itself.

References #990.
src/libstrongswan/utils/utils.c