1
0
mirror of https://github.com/php/php-src.git synced 2026-04-10 17:43:13 +02:00

Solaris/x86 insists of having a large buffer for storing the result of

readdir_r(), otherwise it will segfault.

PR: #6479
This commit is contained in:
Sascha Schumann
2000-09-01 09:38:19 +00:00
parent fd49c6ff05
commit d60799bf6b
2 changed files with 5 additions and 4 deletions

View File

@@ -151,7 +151,8 @@ static void _ps_files_open(ps_files *data, const char *key)
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 @@ static int _ps_files_cleanup_dir(const char *dirname, int maxlifetime)
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 */

View File

@@ -289,13 +289,13 @@ PHP_FUNCTION(readdir)
{
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;