On Fri, Oct 28, 2011 at 05:49:59AM -0600, Eric Blake wrote:
On 10/28/2011 02:28 AM, Daniel P. Berrange wrote:
>>>+ if ((fd = dup(msg->fds[slot]))< 0) {
>>>+ virReportSystemError(errno,
>>>+ _("Unable to duplicate FD %d"),
>>>+ msg->fds[slot]);
>>>+ return -1;
>>>+ }
>>
>>Do we want to be using gnulib's dup_cloexec ("cloexec.h") or
>>fcntl(fd, F_DUPFD_CLOEXEC, 0) here, so that our dup doesn't leak
>>into a third-party child if we are linked into some larger
>>multithreaded app?
>
>dup3() is the new glibc API for this ? Does gnulib support
>that yet ?
Gnulib supports dup3(). But dup3() is not the same as dup(); it is
the same as dup2(). That is:
dup(fd) maps to fcntl(fd, F_DUPFD_CLOEXEC,0) == dup_cloexec(fd)
dup2(fd1, fd2) maps to dup3(fd1, fd2, O_CLOEXEC)
Ah ok, I see what you mean.
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|