os: wrap SOCK_CLOEXEC

Signed-off-by: Weijia Wang <contact@weijia.wang>
This commit is contained in:
Weijia Wang 2022-07-28 01:37:50 +02:00
parent 60827b862e
commit fe70c799e5
6 changed files with 44 additions and 10 deletions

View file

@ -37,6 +37,7 @@
#include <sys/stat.h>
#include <poll.h>
#include "wayland-os.h"
#include "wayland-private.h"
#include "test-runner.h"
#include "test-compositor.h"
@ -48,7 +49,7 @@ setup(int *s)
{
struct wl_connection *connection;
assert(socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, s) == 0);
assert(wl_os_socketpair_cloexec(AF_UNIX, SOCK_STREAM, 0, s) == 0);
connection = wl_connection_create(s[0]);
assert(connection);
@ -181,8 +182,8 @@ struct marshal_data {
static void
setup_marshal_data(struct marshal_data *data)
{
assert(socketpair(AF_UNIX,
SOCK_STREAM | SOCK_CLOEXEC, 0, data->s) == 0);
assert(wl_os_socketpair_cloexec(AF_UNIX,
SOCK_STREAM, 0, data->s) == 0);
data->read_connection = wl_connection_create(data->s[0]);
assert(data->read_connection);
data->write_connection = wl_connection_create(data->s[1]);
@ -824,7 +825,7 @@ TEST(request_bogus_size)
for (bogus_size = 11; bogus_size >= 0; bogus_size--) {
fprintf(stderr, "* bogus size %d\n", bogus_size);
assert(socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, s) == 0);
assert(wl_os_socketpair_cloexec(AF_UNIX, SOCK_STREAM, 0, s) == 0);
display = wl_display_create();
assert(display);
client = wl_client_create(display, s[0]);