cvs: /php4/ext/session mod_files.c

From: Date: Sun, 22 Aug 1999 13:43:24 +0000
Subject: cvs: /php4/ext/session mod_files.c
Groups: php.version4 
Request: Send a blank email to php-version4+get-3636@lists.php.net to get a copy of this message
sas Sun Aug 22 09:43:24 1999 EDT Modified files: /php4/ext/session mod_files.c Log: Use O_EXCL where possible. Index: php4/ext/session/mod_files.c diff -u php4/ext/session/mod_files.c:1.9 php4/ext/session/mod_files.c:1.10 --- php4/ext/session/mod_files.c:1.9 Fri Jul 16 09:12:55 1999 +++ php4/ext/session/mod_files.c Sun Aug 22 09:43:23 1999 @@ -110,10 +110,18 @@ data->lastkey = estrdup(key); +#ifdef O_EXCL + data->fd = open(buf, O_EXCL | O_RDWR | O_CREAT, 0600); + /* -1, if file exists and access failed due to O_EXCL|O_CREAT */ + if(data->fd == -1) { + data->fd = open(buf, O_EXCL | O_RDWR); + } +#else data->fd = open(buf, O_CREAT | O_RDWR, 0600); - if(data->fd > -1) { + if(data->fd != -1) { flock(data->fd, LOCK_EX); } +#endif } }

« previous php.version4 (#3636) next »