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

@ -28,6 +28,7 @@
#include <unistd.h>
#include <stdint.h>
#include "wayland-os.h"
#include "wayland-server.h"
#include "test-runner.h"
@ -40,7 +41,7 @@ TEST(create_resource_tst)
int s[2];
uint32_t id;
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]);
@ -111,7 +112,7 @@ TEST(destroy_res_tst)
.notify = &destroy_notify
};
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]);
@ -159,7 +160,7 @@ TEST(create_resource_with_same_id)
int s[2];
uint32_t id;
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]);