diff options
author | Sascha Schumann <sas@php.net> | 2000-05-23 15:13:16 +0000 |
---|---|---|
committer | Sascha Schumann <sas@php.net> | 2000-05-23 15:13:16 +0000 |
commit | 2aaa538aef24cd8140ff6aa80e544978dd7035fd (patch) | |
tree | 1aa8491f80a1d81bb80ca0f118b19f98e5b21163 /ext/session/mod_files.c | |
parent | be6afb3fccd20f2b0fab5816bc05362fb7e0326f (diff) | |
download | php-git-2aaa538aef24cd8140ff6aa80e544978dd7035fd.tar.gz |
Use reentrant version of readdir. If the target platform does not support
the POSIX-like readdir_r, we fall back to readdir. In ZTS mode, this will
cause php_readdir_r calls to be serialized.
Diffstat (limited to 'ext/session/mod_files.c')
-rw-r--r-- | ext/session/mod_files.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c index aefebc1df5..32f511d18a 100644 --- a/ext/session/mod_files.c +++ b/ext/session/mod_files.c @@ -154,7 +154,7 @@ 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; + struct dirent *entry, dentry; struct stat sbuf; char buf[MAXPATHLEN]; time_t now; @@ -168,7 +168,7 @@ static int _ps_files_cleanup_dir(const char *dirname, int maxlifetime) time(&now); - while((entry = readdir(dir))) { + while (php_readdir_r(dir, &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 */ |