2007-07-22 Roland McGrath <roland@frob.com>
[platform/upstream/glibc.git] / hurd / port2fd.c
index 48b74f1..262e6d9 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994, 1997, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1994, 1997, 1999, 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
@@ -55,7 +55,7 @@ _hurd_port2fd (struct hurd_fd *d, io_t dport, int flags)
     mach_port_t old
       = _hurd_userlink_clear (&d->port.users) ? d->port.port : MACH_PORT_NULL;
     d->port.port = dport;
-    d->flags = 0;
+    d->flags = (flags & O_CLOEXEC) ? FD_CLOEXEC : 0;
     if (old != MACH_PORT_NULL)
       __mach_port_deallocate (__mach_task_self (), old);
   }