diff options
author | Stanislav Malyshev <stas@php.net> | 2000-08-05 10:25:00 +0000 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2000-08-05 10:25:00 +0000 |
commit | 682c58c26fd6634201b5b3c58277c5215e682841 (patch) | |
tree | 19636aa6610d711752b2c246c27c182d90213af8 /ext | |
parent | 34dfe582ff740c207da14afdc18c678a102e578e (diff) | |
download | php-git-682c58c26fd6634201b5b3c58277c5215e682841.tar.gz |
Open session files in binary mode (fix #5953)
@- Fixed \n in session variables bug on Win32 (Stas)
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 |