Hi,
During the gcc testsuite, I've found that a fd leak is occuring. I don't have a minimal test case but with this patch the fd leak disappeares .
This patch is inspired by the Fedora one available in their last RPM of expect. But some OSes like AIX don't have F_DUPFD_CLOEXEC flag. This one should work on all the OSes which have at least FD_CLOEXEC flag.
There is a mistake in the previous version... This one should be better.
In principle it looks good - except why do you use '#elsepu' and not '#else'?
Applied the second one - but changed the #elsepu to #else.
Thank you.