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 /main/reentrancy.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 'main/reentrancy.c')
-rw-r--r-- | main/reentrancy.c | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/main/reentrancy.c b/main/reentrancy.c index 12e2548666..08f03e76dd 100644 --- a/main/reentrancy.c +++ b/main/reentrancy.c @@ -109,54 +109,6 @@ PHPAPI struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm) #endif -#if !defined(HAVE_POSIX_READDIR_R) - -PHPAPI int php_readdir_r(DIR *dirp, struct dirent *entry, - struct dirent **result) -{ -#if defined(HAVE_OLD_READDIR_R) - int ret = 0; - - /* We cannot rely on the return value of readdir_r - as it differs between various platforms - (HPUX returns 0 on success whereas Solaris returns non-zero) - */ - entry->d_name[0] = '\0'; - readdir_r(dirp, entry); - - if (entry->d_name[0] == '\0') { - *result = NULL; - ret = errno; - } else { - *result = entry; - } - return ret; -#else - struct dirent *ptr; - int ret = 0; - - local_lock(READDIR_R); - - errno = 0; - - ptr = readdir(dirp); - - if (!ptr && errno != 0) - ret = errno; - - if (ptr) - memcpy(entry, ptr, sizeof(*ptr)); - - *result = ptr; - - local_unlock(READDIR_R); - - return ret; -#endif -} - -#endif - #if !defined(HAVE_LOCALTIME_R) && defined(HAVE_LOCALTIME) PHPAPI struct tm *php_localtime_r(const time_t *const timep, struct tm *p_tm) |