vlc/vlc-2.0 | branch: master | KO Myung-Hun <kom...@gmail.com> | Sat May 12 
23:16:00 2012 +0900| [859509ab36239133ef05fe20d85a28131d87a549] | committer: 
Rémi Denis-Courmont

Fix the problem that 'Open Directory...' does not work on OS/2

fpathconf (_PC_NAME_MAX) set errno to EBADF. This leads vlc_loaddir() to
misinterpret the result of vlc_readdir() if there are no more files.

Signed-off-by: Rémi Denis-Courmont <r...@remlab.net>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=859509ab36239133ef05fe20d85a28131d87a549
---

 src/posix/filesystem.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/posix/filesystem.c b/src/posix/filesystem.c
index 7d9e723..49d07fc 100644
--- a/src/posix/filesystem.c
+++ b/src/posix/filesystem.c
@@ -190,8 +190,8 @@ char *vlc_readdir( DIR *dir )
     struct dirent *ent;
     char *path = NULL;
 
+#if !defined(__OS2__) || !defined(__KLIBC__)
     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)
@@ -202,12 +202,12 @@ char *vlc_readdir( DIR *dir )
         return NULL;
 #endif
     len += offsetof (struct dirent, d_name) + 1;
-#else /* __OS2__ && __INNOTEK_LIBC__ */
+#else /* __OS2__ && __KLIBC__ */
     /* 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.
+     * fpathconf (_PC_NAME_MAX) is broken, and errno is set to EBADF.
+     * Moreover, 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);
+    long len = sizeof (struct dirent);
 #endif
 
     struct dirent *buf = malloc (len);

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
http://mailman.videolan.org/listinfo/vlc-commits

Reply via email to