summaryrefslogtreecommitdiff
path: root/gzlib.c
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2012-03-04 11:26:25 -0800
committerMark Adler <madler@alumni.caltech.edu>2012-03-04 11:26:25 -0800
commit2e04ce09154a078910a7878f2e36905f458f309f (patch)
tree9b5672056e9b2d45bd651538a7100e9df5022a0f /gzlib.c
parente3ba2a10cacd2e7786cecfa12466df544747ff7c (diff)
downloadzlib-2e04ce09154a078910a7878f2e36905f458f309f.tar.gz
Make sure that O_EXCL is used portably.
Diffstat (limited to 'gzlib.c')
-rw-r--r--gzlib.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gzlib.c b/gzlib.c
index fec7fbf..4732fcc 100644
--- a/gzlib.c
+++ b/gzlib.c
@@ -196,10 +196,13 @@ local gzFile gz_open(path, fd, mode)
#endif
(state->mode == GZ_READ ?
O_RDONLY :
- (O_WRONLY | O_CREAT | (exclusive ? O_EXCL : 0) | (
- state->mode == GZ_WRITE ?
- O_TRUNC :
- O_APPEND))),
+ (O_WRONLY | O_CREAT |
+#ifdef O_EXCL
+ (exclusive ? O_EXCL : 0) |
+#endif
+ (state->mode == GZ_WRITE ?
+ O_TRUNC :
+ O_APPEND))),
0666);
if (state->fd == -1) {
free(state->path);