Commit 321c1d51 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Use vlc_socketpair()

parent 9d02c991
......@@ -30,9 +30,6 @@
#include <sys/types.h>
#include <unistd.h>
#include <sys/socket.h>
#ifndef SOCK_CLOEXEC
# define SOCK_CLOEXEC 0
#endif
#include <vlc_common.h>
#include <vlc_block.h>
......@@ -47,7 +44,7 @@ static void conn_create(void)
{
int fds[2];
if (socketpair(PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC, 0, fds))
if (vlc_socketpair(PF_LOCAL, SOCK_STREAM, 0, fds, false))
assert(!"socketpair");
struct vlc_tls *tls = vlc_tls_DummyCreate(NULL, fds[1]);
......
......@@ -30,9 +30,6 @@
#include <sys/types.h>
#include <unistd.h>
#include <sys/socket.h>
#ifndef SOCK_CLOEXEC
# define SOCK_CLOEXEC 0
#endif
#include <vlc_common.h>
#include <vlc_block.h>
......@@ -93,7 +90,7 @@ static void conn_create(void)
int fds[2];
char hello[24];
if (socketpair(PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC, 0, fds))
if (vlc_socketpair(PF_LOCAL, SOCK_STREAM, 0, fds, false))
assert(!"socketpair");
struct vlc_tls *tls = vlc_tls_DummyCreate(NULL, fds[1]);
......
......@@ -258,7 +258,7 @@ int vlc_dup (int oldfd)
int vlc_pipe (int fds[2])
{
if (socketpair (AF_LOCAL, SOCK_STREAM, 0, fds))
if (vlc_socketpair (AF_LOCAL, SOCK_STREAM, 0, fds, false))
return -1;
shutdown (fds[0], SHUT_WR);
......@@ -267,8 +267,6 @@ int vlc_pipe (int fds[2])
setmode (fds[0], O_BINARY);
setmode (fds[1], O_BINARY);
fcntl (fds[0], F_SETFD, FD_CLOEXEC);
fcntl (fds[1], F_SETFD, FD_CLOEXEC);
return 0;
}
......
......@@ -30,9 +30,6 @@
#include <sys/types.h>
#include <sys/socket.h>
#ifndef SOCK_CLOEXEC
# define SOCK_CLOEXEC 0
#endif
#include <poll.h>
#include <fcntl.h>
#include <unistd.h>
......@@ -47,12 +44,7 @@
static int tlspair(int fds[2])
{
if (socketpair(PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC, 0, fds))
return -1;
fcntl(fds[0], F_SETFL, O_NONBLOCK | fcntl(fds[0], F_GETFL));
fcntl(fds[1], F_SETFL, O_NONBLOCK | fcntl(fds[1], F_GETFL));
return 0;
return vlc_socketpair(PF_LOCAL, SOCK_STREAM, 0, fds, true);
}
static int question_callback(vlc_object_t *obj, const char *varname,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment