summaryrefslogtreecommitdiff
path: root/sysdeps/mach/hurd/fcntl.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-12-12 18:13:35 +0000
committerJakub Jelinek <jakub@redhat.com>2007-12-12 18:13:35 +0000
commit574e283890a6ca92325a06dafa76ff307a8019a2 (patch)
tree055e44e24a55fb4863e5d9cdc04e320cde52ffe9 /sysdeps/mach/hurd/fcntl.c
parenta162e5955f7e324be82d9318bbcbe869c66ffb86 (diff)
Updated to fedora-glibc-20071212T1051
Diffstat (limited to 'sysdeps/mach/hurd/fcntl.c')
-rw-r--r--sysdeps/mach/hurd/fcntl.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sysdeps/mach/hurd/fcntl.c b/sysdeps/mach/hurd/fcntl.c
index d4e4aa5da1..470614b360 100644
--- a/sysdeps/mach/hurd/fcntl.c
+++ b/sysdeps/mach/hurd/fcntl.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-1997,1999,2000,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1992-1997,1999,2000,2002,2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -50,6 +50,7 @@ __libc_fcntl (int fd, int cmd, ...)
/* First the descriptor-based commands, which do no RPCs. */
case F_DUPFD: /* Duplicate the file descriptor. */
+ case F_DUPFD_CLOEXEC:
{
struct hurd_fd *new;
io_t port, ctty;
@@ -64,6 +65,12 @@ __libc_fcntl (int fd, int cmd, ...)
ctty = _hurd_port_get (&d->ctty, &ctty_ulink);
port = _hurd_port_locked_get (&d->port, &ulink); /* Unlocks D. */
+ if (cmd == F_DUPFD_CLOEXEC)
+ flags |= FD_CLOEXEC;
+ else
+ /* Duplication clears the FD_CLOEXEC flag. */
+ flags &= ~FD_CLOEXEC;
+
/* Get a new file descriptor. The third argument to __fcntl is the
minimum file descriptor number for it. */
new = _hurd_alloc_fd (&result, va_arg (ap, int));
@@ -82,8 +89,7 @@ __libc_fcntl (int fd, int cmd, ...)
/* Install the ports and flags in the new descriptor. */
if (ctty != MACH_PORT_NULL)
_hurd_port_set (&new->ctty, ctty);
- /* Duplication clears the FD_CLOEXEC flag. */
- new->flags = flags & ~FD_CLOEXEC;
+ new->flags = flags;
_hurd_port_locked_set (&new->port, port); /* Unlocks NEW. */
}