From ac30cc3d6bd7b01c41aeec8bf74af920abcf5a9b Mon Sep 17 00:00:00 2001 From: jorton Date: Sun, 31 Jan 2010 16:27:32 +0000 Subject: Merge r905040 from trunk: * file_io/unix/open.c (apr_file_open): Don't set FD_CLOEXEC if it was already set via O_CLOEXEC. PR: 46297 git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.4.x@905066 13f79535-47bb-0310-9956-ffa450edef68 --- file_io/unix/open.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'file_io/unix') diff --git a/file_io/unix/open.c b/file_io/unix/open.c index bf3b43b6a..be0862318 100644 --- a/file_io/unix/open.c +++ b/file_io/unix/open.c @@ -176,9 +176,11 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, if ((flags = fcntl(fd, F_GETFD)) == -1) return errno; - flags |= FD_CLOEXEC; - if (fcntl(fd, F_SETFD, flags) == -1) - return errno; + if ((flags & FD_CLOEXEC) == 0) { + flags |= FD_CLOEXEC; + if (fcntl(fd, F_SETFD, flags) == -1) + return errno; + } } (*new) = (apr_file_t *)apr_pcalloc(pool, sizeof(apr_file_t)); -- cgit v1.2.1