diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-09-18 18:06:28 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-09-18 18:06:28 +0000 |
commit | 7341e544a603b629235731ade8faace5666d1180 (patch) | |
tree | 44912af377a1284ca36611f9b8acc53b753eb783 /libbacktrace/posix.c | |
parent | d48b4b141d4e420c86aafb9f746b397bc04cfaa9 (diff) | |
download | gcc-7341e544a603b629235731ade8faace5666d1180.tar.gz |
* posix.c (O_BINARY): Define if not defined.
(backtrace_open): Pass O_BINARY to open. Only call fcntl if
HAVE_FCNTL is defined.
* configure.ac: Test for the fcntl function.
* configure, config.h.in: Rebuild.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@191443 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libbacktrace/posix.c')
-rw-r--r-- | libbacktrace/posix.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libbacktrace/posix.c b/libbacktrace/posix.c index 0b76f1e94a1..01afc42b08e 100644 --- a/libbacktrace/posix.c +++ b/libbacktrace/posix.c @@ -41,6 +41,10 @@ POSSIBILITY OF SUCH DAMAGE. */ #include "backtrace.h" #include "internal.h" +#ifndef O_BINARY +#define O_BINARY 0 +#endif + #ifndef O_CLOEXEC #define O_CLOEXEC 0 #endif @@ -57,18 +61,20 @@ backtrace_open (const char *filename, backtrace_error_callback error_callback, { int descriptor; - descriptor = open (filename, O_RDONLY | O_CLOEXEC); + descriptor = open (filename, O_RDONLY | O_BINARY | O_CLOEXEC); if (descriptor < 0) { error_callback (data, filename, errno); return -1; } +#ifdef HAVE_FCNTL /* Set FD_CLOEXEC just in case the kernel does not support O_CLOEXEC. It doesn't matter if this fails for some reason. FIXME: At some point it should be safe to only do this if O_CLOEXEC == 0. */ fcntl (descriptor, F_SETFD, FD_CLOEXEC); +#endif return descriptor; } |