[please don't top-post on technical lists]
On 01/31/2012 02:47 AM, Daniel Espling wrote:
Sorry for the spamming, but changing the below code:
if (cloexec)
fd = fcntl(sock->fd, F_DUPFD_CLOEXEC);
else
fd = dup(sock->fd);
to:
fd = dup(sock->fd);
if (cloexec && fd >= 0)
cntl(fd, F_SETFD, FD_CLOEXEC);
made it work for me.
Thanks for the report. However, you shouldn't need to make this change.
Gnulib should be replacing fcntl() on kernels that are too old to
support F_DUPFD_CLOEXEC, and doing that work on your behalf so that the
rest of the code can be written as though it were targetting newer
kernels (with the only drawback being that it is not atomic like it is
with newer kernels).
I'll need to see if I can reproduce this situation, and figure out why
gnulib isn't doing the right thing.
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org