Re: I'm done with O_CLOEXEC
- From: Jürg Billeter <j bitron ch>
- To: Ryan Lortie <desrt desrt ca>
- Cc: gtk-devel-list gnome org
- Subject: Re: I'm done with O_CLOEXEC
- Date: Sat, 21 Mar 2015 06:27:20 +0100
On Fri, 2015-03-20 at 16:43 -0400, Ryan Lortie wrote:
What led me to this was the dup3() system call. This is a variant of
dup2() that was added (as part of the efforts mentioned above) to avoid
the O_CLOEXEC race:
int dup3(int oldfd, int newfd, int flags);
unfortunately:
dup3(0, -1, 0) = -1 EBADF (Bad file
descriptor)
which means that using this as a stand-in for dup() is a no-go.
Doesn't the following standard POSIX functionality provide what you
want?
fcntl(fd, F_DUPFD_CLOEXEC, 0)
Regards,
Jürg
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]