os: Provide wl_os_socketpair_cloexec wrapper for systems without SOCK_CLOEXEC

Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Signed-off-by: Weijia Wang <contact@weijia.wang>
This commit is contained in:
Weijia Wang 2022-07-28 01:37:50 +02:00 committed by Jeremy Huddleston Sequoia
parent b5cb23d698
commit e519c4318c
6 changed files with 42 additions and 10 deletions

View file

@ -34,6 +34,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include "wayland-os.h"
#include "wayland-private.h"
#include "wayland-server.h"
#include "test-runner.h"
@ -88,7 +89,7 @@ TEST(client_destroy_listener)
struct client_destroy_listener a, b;
int s[2];
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]);