diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2012-03-04 11:26:25 -0800 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2012-03-04 11:26:25 -0800 |
commit | 2e04ce09154a078910a7878f2e36905f458f309f (patch) | |
tree | 9b5672056e9b2d45bd651538a7100e9df5022a0f | |
parent | e3ba2a10cacd2e7786cecfa12466df544747ff7c (diff) | |
download | zlib-2e04ce09154a078910a7878f2e36905f458f309f.tar.gz zlib-2e04ce09154a078910a7878f2e36905f458f309f.tar.bz2 zlib-2e04ce09154a078910a7878f2e36905f458f309f.zip |
Make sure that O_EXCL is used portably.
-rw-r--r-- | gzlib.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -196,10 +196,13 @@ local gzFile gz_open(path, fd, mode) | |||
196 | #endif | 196 | #endif |
197 | (state->mode == GZ_READ ? | 197 | (state->mode == GZ_READ ? |
198 | O_RDONLY : | 198 | O_RDONLY : |
199 | (O_WRONLY | O_CREAT | (exclusive ? O_EXCL : 0) | ( | 199 | (O_WRONLY | O_CREAT | |
200 | state->mode == GZ_WRITE ? | 200 | #ifdef O_EXCL |
201 | O_TRUNC : | 201 | (exclusive ? O_EXCL : 0) | |
202 | O_APPEND))), | 202 | #endif |
203 | (state->mode == GZ_WRITE ? | ||
204 | O_TRUNC : | ||
205 | O_APPEND))), | ||
203 | 0666); | 206 | 0666); |
204 | if (state->fd == -1) { | 207 | if (state->fd == -1) { |
205 | free(state->path); | 208 | free(state->path); |