summaryrefslogtreecommitdiff
path: root/main/reentrancy.c
diff options
context:
space:
mode:
authorSascha Schumann <sas@php.net>2000-05-24 11:06:57 +0000
committerSascha Schumann <sas@php.net>2000-05-24 11:06:57 +0000
commit25df65b0b8b5105159410c1c3cf0a08449353975 (patch)
tree669f56fe6ac4faa52f00e6cf8b9859950d06e7e3 /main/reentrancy.c
parentff4031585ae93d59cd129668326e91a25bc9ab17 (diff)
downloadphp-git-25df65b0b8b5105159410c1c3cf0a08449353975.tar.gz
Support old-style readdir_r()
Diffstat (limited to 'main/reentrancy.c')
-rw-r--r--main/reentrancy.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/main/reentrancy.c b/main/reentrancy.c
index d9dd97fec8..c180a5af2b 100644
--- a/main/reentrancy.c
+++ b/main/reentrancy.c
@@ -99,6 +99,20 @@ PHPAPI struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm)
PHPAPI int php_readdir_r(DIR *dirp, struct dirent *entry,
struct dirent **result)
{
+#if defined(HAVE_OLD_READDIR_R)
+ int ret;
+
+ errno = 0;
+
+ ret = readdir_r(dirp, entry);
+
+ if (ret == 0)
+ *result = entry;
+ else
+ *result = NULL;
+
+ return ret;
+#else
struct dirent *ptr;
int ret = 0;
@@ -120,6 +134,7 @@ PHPAPI int php_readdir_r(DIR *dirp, struct dirent *entry,
local_unlock(READDIR_R);
return ret;
+#endif
}
#endif