cvs: php4 /ext/session mod_files.c /ext/standard dir.c
| From: | Sascha Schumann | Date: | Fri, 01 Sep 2000 09:38:19 +0000 |
| Subject: | cvs: php4 /ext/session mod_files.c /ext/standard dir.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-1482@lists.php.net to get a copy of this message | ||
sas Fri Sep 1 02:38:19 2000 EDT
Modified files:
/php4/ext/session mod_files.c
/php4/ext/standard dir.c
Log:
Solaris/x86 insists of having a large buffer for storing the result of
readdir_r(), otherwise it will segfault.
PR: #6479
Index: php4/ext/session/mod_files.c
diff -u php4/ext/session/mod_files.c:1.42 php4/ext/session/mod_files.c:1.43
--- php4/ext/session/mod_files.c:1.42 Sun Aug 20 15:18:19 2000
+++ php4/ext/session/mod_files.c Fri Sep 1 02:38:18 2000
@@ -151,7 +151,8 @@
static int _ps_files_cleanup_dir(const char *dirname, int maxlifetime)
{
DIR *dir;
- struct dirent *entry, dentry;
+ char dentry[sizeof(struct dirent) + PATH_MAX + 1];
+ struct dirent *entry;
struct stat sbuf;
char buf[MAXPATHLEN];
time_t now;
@@ -165,7 +166,7 @@
time(&now);
- while (php_readdir_r(dir, &dentry, &entry) == 0 && entry) {
+ while (php_readdir_r(dir, (struct dirent *) dentry, &entry) == 0 && entry) {
/* does the file start with our prefix? */
if (!strncmp(entry->d_name, FILE_PREFIX, sizeof(FILE_PREFIX) - 1) &&
/* create full path */
Index: php4/ext/standard/dir.c
diff -u php4/ext/standard/dir.c:1.41 php4/ext/standard/dir.c:1.42
--- php4/ext/standard/dir.c:1.41 Thu Jun 29 14:51:39 2000
+++ php4/ext/standard/dir.c Fri Sep 1 02:38:19 2000
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dir.c,v 1.41 2000/06/29 21:51:39 zeev Exp $ */
+/* $Id: dir.c,v 1.42 2000/09/01 09:38:19 sas Exp $ */
/* {{{ includes/startup/misc */
@@ -289,13 +289,13 @@
{
pval **id, **tmp, *myself;
php_dir *dirp;
- struct dirent entry;
+ char entry[sizeof(struct dirent) + PATH_MAX + 1];
struct dirent *result;
DIRLS_FETCH();
FETCH_DIRP();
- if (php_readdir_r(dirp->dir, &entry, &result) == 0 && result) {
+ if (php_readdir_r(dirp->dir, (struct dirent *) entry, &result) == 0 && result) {
RETURN_STRINGL(result->d_name, strlen(result->d_name), 1);
}
RETURN_FALSE;