]> granicus.if.org Git - php/commitdiff
Open session files in binary mode (fix #5953)
authorStanislav Malyshev <stas@php.net>
Sat, 5 Aug 2000 10:25:00 +0000 (10:25 +0000)
committerStanislav Malyshev <stas@php.net>
Sat, 5 Aug 2000 10:25:00 +0000 (10:25 +0000)
@- Fixed \n in session variables bug on Win32 (Stas)

ext/session/mod_files.c

index 237a2ef5673dbcc4935d6698a9bb64378adbf659..cc8b7f9a662f7d309b0553174a7fe58db5ff459e 100644 (file)
@@ -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