Fix open_cloexec on hosts which ignore O_CLOEXEC (i.e. old kernels).
* lib/fdleak.c (o_cloexec_works): New function, detects whether
the open flag O_CLOEXEC has any effect.
(open_cloexec): Call o_cloexec_works, just once, to find out
whether O_CLOEXEC is effective. If not, set the close-on-exec
flag on fds by calling set_cloexec_flag.
Signed-off-by: James Youngman <jay@gnu.org>
Signed-off-by: James Youngman <jay@gnu.org>