[vlc-commits] Fix vlc_readdir() for OS/2

KO Myung-Hun git at videolan.org
Sat Oct 15 09:38:49 CEST 2011


vlc | branch: master | KO Myung-Hun <komh at chollian.net> | Fri Oct 14 21:22:04 2011 +0900| [9ab620e712c5c4eb61f588ab599cb8a898f69b1c] | committer: Rémi Denis-Courmont

Fix vlc_readdir() for OS/2

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9ab620e712c5c4eb61f588ab599cb8a898f69b1c
---

 src/posix/filesystem.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/posix/filesystem.c b/src/posix/filesystem.c
index b33b485..eda796e 100644
--- a/src/posix/filesystem.c
+++ b/src/posix/filesystem.c
@@ -191,6 +191,7 @@ char *vlc_readdir( DIR *dir )
     char *path = NULL;
 
     long len = fpathconf (dirfd (dir), _PC_NAME_MAX);
+#if !defined(__OS2__) || !defined(__INNOTEK_LIBC__)
 #ifdef NAME_MAX
     /* POSIX says there shall we room for NAME_MAX bytes at all times */
     if (/*len == -1 ||*/ len < NAME_MAX)
@@ -201,6 +202,13 @@ char *vlc_readdir( DIR *dir )
         return NULL;
 #endif
     len += offsetof (struct dirent, d_name) + 1;
+#else /* __OS2__ && __INNOTEK_LIBC__ */
+    /* In the implementation of Innotek LIBC, aka kLIBC on OS/2,
+     * fpathconf (_PC_NAME_MAX) is broken, and d_name is not the last member
+     * of struct dirent.
+     * So just allocate as many as the size of struct dirent. */
+    len = sizeof (struct dirent);
+#endif
 
     struct dirent *buf = malloc (len);
     if (unlikely(buf == NULL))



More information about the vlc-commits mailing list