From: Stanislav Malyshev Date: Sat, 5 Aug 2000 10:25:00 +0000 (+0000) Subject: Open session files in binary mode (fix #5953) X-Git-Tag: PRE_FILE_COMPILE_API_CHANGE~21 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=682c58c26fd6634201b5b3c58277c5215e682841;p=php Open session files in binary mode (fix #5953) @- Fixed \n in session variables bug on Win32 (Stas) --- 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