cvs: php4(PHP_4_0_6) /ext/session mod_files.c
| From: | Sascha Schumann | Date: | Sat, 12 May 2001 09:42:46 +0000 |
| Subject: | cvs: php4(PHP_4_0_6) /ext/session mod_files.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-5689@lists.php.net to get a copy of this message | ||
sas Sat May 12 02:42:46 2001 EDT
Modified files: (Branch: PHP_4_0_6)
/php4/ext/session mod_files.c
Log:
MFH fix for new-session-files-were-not-locked
Index: php4/ext/session/mod_files.c
diff -u php4/ext/session/mod_files.c:1.53 php4/ext/session/mod_files.c:1.53.2.1
--- php4/ext/session/mod_files.c:1.53 Mon Apr 30 05:43:38 2001
+++ php4/ext/session/mod_files.c Sat May 12 02:42:46 2001
@@ -140,18 +140,13 @@
#ifdef O_EXCL
data->fd = VCWD_OPEN((buf, O_RDWR | O_BINARY));
- if (data->fd == -1) {
- if (errno == ENOENT) {
- data->fd = VCWD_OPEN((buf, O_EXCL | O_RDWR | O_CREAT | O_BINARY, 0600));
- }
- } else {
- flock(data->fd, LOCK_EX);
- }
+ if (data->fd == -1 && errno == ENOENT)
+ data->fd = VCWD_OPEN((buf, O_EXCL | O_RDWR | O_CREAT | O_BINARY, 0600));
#else
data->fd = VCWD_OPEN((buf, O_CREAT | O_RDWR | O_BINARY, 0600));
+#endif
if (data->fd != -1)
flock(data->fd, LOCK_EX);
-#endif
if (data->fd == -1)
php_error(E_WARNING, "open(%s, O_RDWR) failed: %m (%d)", buf, errno);