diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-04-11 14:25:40 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-04-11 16:52:36 +0200 |
commit | 2b28f7189144a21e753dbc09efadd571121a82b9 (patch) | |
tree | b40f387f5be293dde192f2743d14323160669128 /ext/session/mod_files.c | |
parent | 3e0f9c2c94d1511eaf30f8f1de8260f5821c985f (diff) | |
download | php-git-2b28f7189144a21e753dbc09efadd571121a82b9.tar.gz |
Use readdir() instead of readdir_r()
readdir_r() is deprecated in modern glibc versions. readdir() is
thread safe in practice, as long as there are no concurrent accesses
on the *same* directory stream.
Diffstat (limited to 'ext/session/mod_files.c')
-rw-r--r-- | ext/session/mod_files.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c index 552d990fe3..cb8138e60a 100644 --- a/ext/session/mod_files.c +++ b/ext/session/mod_files.c @@ -284,8 +284,7 @@ static int ps_files_write(ps_files *data, zend_string *key, zend_string *val) static int ps_files_cleanup_dir(const char *dirname, zend_long maxlifetime) { DIR *dir; - char dentry[sizeof(struct dirent) + MAXPATHLEN]; - struct dirent *entry = (struct dirent *) &dentry; + struct dirent *entry; zend_stat_t sbuf; char buf[MAXPATHLEN]; time_t now; @@ -312,7 +311,7 @@ static int ps_files_cleanup_dir(const char *dirname, zend_long maxlifetime) memcpy(buf, dirname, dirname_len); buf[dirname_len] = PHP_DIR_SEPARATOR; - while (php_readdir_r(dir, (struct dirent *) dentry, &entry) == 0 && entry) { + while ((entry = readdir(dir))) { /* does the file start with our prefix? */ if (!strncmp(entry->d_name, FILE_PREFIX, sizeof(FILE_PREFIX) - 1)) { size_t entry_len = strlen(entry->d_name); |