Make sure that O_EXCL is used portably.

This commit is contained in:
Mark Adler 2012-03-04 11:26:25 -08:00
parent e3ba2a10ca
commit 2e04ce0915

11
gzlib.c
View File

@ -196,10 +196,13 @@ local gzFile gz_open(path, fd, mode)
#endif #endif
(state->mode == GZ_READ ? (state->mode == GZ_READ ?
O_RDONLY : O_RDONLY :
(O_WRONLY | O_CREAT | (exclusive ? O_EXCL : 0) | ( (O_WRONLY | O_CREAT |
state->mode == GZ_WRITE ? #ifdef O_EXCL
O_TRUNC : (exclusive ? O_EXCL : 0) |
O_APPEND))), #endif
(state->mode == GZ_WRITE ?
O_TRUNC :
O_APPEND))),
0666); 0666);
if (state->fd == -1) { if (state->fd == -1) {
free(state->path); free(state->path);