diff options
author | trawick <trawick@13f79535-47bb-0310-9956-ffa450edef68> | 2010-02-01 15:33:11 +0000 |
---|---|---|
committer | trawick <trawick@13f79535-47bb-0310-9956-ffa450edef68> | 2010-02-01 15:33:11 +0000 |
commit | 161bf974b3c23d33a27999e647c9f26c015219fa (patch) | |
tree | 77f389edf54f6e4a520e251617f91194c6c61319 /file_io | |
parent | 97b42c3761b011fe47cafd2d3191f3f5077dcbed (diff) | |
download | libapr-161bf974b3c23d33a27999e647c9f26c015219fa.tar.gz |
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
Submitted by: jorton
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@905308 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io')
-rw-r--r-- | file_io/unix/open.c | 8 |
1 files changed, 5 insertions, 3 deletions
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)); |