diff options
author | Sascha Schumann <sas@php.net> | 2001-05-12 09:42:46 +0000 |
---|---|---|
committer | Sascha Schumann <sas@php.net> | 2001-05-12 09:42:46 +0000 |
commit | 3e91a688d82b23f9960b3545b0c76a0ec7d1b7ff (patch) | |
tree | 38427a07397f0ffa5c0e7527b336ac5fd15f1794 | |
parent | bb503667355b9123f322692bbadcc85832668aaf (diff) | |
download | php-git-3e91a688d82b23f9960b3545b0c76a0ec7d1b7ff.tar.gz |
MFH fix for new-session-files-were-not-locked
-rw-r--r-- | ext/session/mod_files.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c index ab24ee6354..2802eb98e2 100644 --- a/ext/session/mod_files.c +++ b/ext/session/mod_files.c @@ -140,18 +140,13 @@ static void ps_files_open(ps_files *data, const char *key) #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); |