summaryrefslogtreecommitdiff
path: root/main/streams/plain_wrapper.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/streams/plain_wrapper.c')
-rw-r--r--main/streams/plain_wrapper.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c
index dc74bfccc1..1bfb2129dc 100644
--- a/main/streams/plain_wrapper.c
+++ b/main/streams/plain_wrapper.c
@@ -926,16 +926,15 @@ PHPAPI php_stream_ops php_stream_stdio_ops = {
static size_t php_plain_files_dirstream_read(php_stream *stream, char *buf, size_t count)
{
DIR *dir = (DIR*)stream->abstract;
- /* avoid libc5 readdir problems */
- char entry[sizeof(struct dirent)+MAXPATHLEN];
- struct dirent *result = (struct dirent *)&entry;
+ struct dirent *result;
php_stream_dirent *ent = (php_stream_dirent*)buf;
/* avoid problems if someone mis-uses the stream */
if (count != sizeof(php_stream_dirent))
return 0;
- if (php_readdir_r(dir, (struct dirent *)entry, &result) == 0 && result) {
+ result = readdir(dir);
+ if (result) {
PHP_STRLCPY(ent->d_name, result->d_name, sizeof(ent->d_name), strlen(result->d_name));
return sizeof(php_stream_dirent);
}