diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/session/mod_files.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c index 237a2ef567..cc8b7f9a66 100644 --- a/ext/session/mod_files.c +++ b/ext/session/mod_files.c @@ -110,6 +110,10 @@ static char *_ps_files_path_create(char *buf, size_t buflen, ps_files *data, con return buf; } +#ifndef O_BINARY +#define O_BINARY 0 +#endif + static void _ps_files_open(ps_files *data, const char *key) { char buf[MAXPATHLEN]; @@ -131,16 +135,16 @@ static void _ps_files_open(ps_files *data, const char *key) data->lastkey = estrdup(key); #ifdef O_EXCL - data->fd = V_OPEN((buf, O_RDWR)); + data->fd = V_OPEN((buf, O_RDWR | O_BINARY)); if (data->fd == -1) { if (errno == ENOENT) { - data->fd = V_OPEN((buf, O_EXCL | O_RDWR | O_CREAT, 0600)); + data->fd = V_OPEN((buf, O_EXCL | O_RDWR | O_CREAT | O_BINARY, 0600)); } } else { flock(data->fd, LOCK_EX); } #else - data->fd = V_OPEN((buf, O_CREAT | O_RDWR, 0600)); + data->fd = V_OPEN((buf, O_CREAT | O_RDWR | O_BINARY, 0600)); if (data->fd != -1) flock(data->fd, LOCK_EX); #endif |