From b075ad5b007248d50e4c2e838b460c9c7cfd9fad Mon Sep 17 00:00:00 2001 From: Theo Schlossnagle Date: Sun, 31 Mar 2013 04:00:15 +0000 Subject: 3665 Implement O_CLOEXEC as an open() flag Reviewed by: Robert Mustacchi Reviewed by: Gordon Ross Reviewed by: Dan McDonald Approved by: Richard Lowe --- usr/src/uts/common/syscall/open.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'usr/src/uts/common/syscall/open.c') diff --git a/usr/src/uts/common/syscall/open.c b/usr/src/uts/common/syscall/open.c index 6559900158..edb04c824b 100644 --- a/usr/src/uts/common/syscall/open.c +++ b/usr/src/uts/common/syscall/open.c @@ -26,6 +26,9 @@ /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ +/* + * Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. + */ /* * Portions of this source code were derived from Berkeley 4.3 BSD * under license from the Regents of the University of California. @@ -226,6 +229,9 @@ noxattr: * falloc reserved. */ setf(fd, fp); + if ((filemode & FCLOEXEC) != 0) { + f_setfd(fd, FD_CLOEXEC); + } return (fd); } else { /* @@ -252,6 +258,9 @@ noxattr: fp->f_count++; mutex_exit(&fp->f_tlock); setf(fd, fp); + if ((filemode & FCLOEXEC) != 0) { + f_setfd(fd, FD_CLOEXEC); + } releasef(dupfd); } return (fd); -- cgit v1.2.3