[vlc-commits] os2: filesystem: re-implement vlc_pipe() with socketpair()

KO Myung-Hun git at videolan.org
Mon Nov 30 14:27:54 CET 2015


vlc | branch: master | KO Myung-Hun <komh78 at gmail.com> | Mon Sep  7 15:56:40 2015 +0900| [4aca906b6b3e5d18f3b50966b2cf40524c82eeec] | committer: Jean-Baptiste Kempf

os2: filesystem: re-implement vlc_pipe() with socketpair()

This improves the compatibility with vlc_poll().

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 src/os2/filesystem.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/os2/filesystem.c b/src/os2/filesystem.c
index 2c42a2e..3d12c99 100644
--- a/src/os2/filesystem.c
+++ b/src/os2/filesystem.c
@@ -44,6 +44,7 @@
 #include <vlc_common.h>
 #include <vlc_charset.h>
 #include <vlc_fs.h>
+#include <vlc_network.h>
 #include "libvlc.h" /* vlc_mkdir */
 
 int vlc_open (const char *filename, int flags, ...)
@@ -257,9 +258,12 @@ int vlc_dup (int oldfd)
 
 int vlc_pipe (int fds[2])
 {
-    if (pipe (fds))
+    if (socketpair (AF_LOCAL, SOCK_STREAM, 0, fds))
         return -1;
 
+    shutdown (fds[0], SHUT_WR);
+    shutdown (fds[1], SHUT_RD);
+
     setmode (fds[0], O_BINARY);
     setmode (fds[1], O_BINARY);
 
@@ -298,8 +302,6 @@ ssize_t vlc_writev(int fd, const struct iovec *iov, int count)
     return val;
 }
 
-#include <vlc_network.h>
-
 int vlc_socket (int pf, int type, int proto, bool nonblock)
 {
     int fd;



More information about the vlc-commits mailing list