From 10b450eaf6c3c244dd20c64d00f1370ca67927d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 26 Jan 2022 14:35:43 +0400 Subject: [PATCH] glib/tests: make fd-assignment-clash run on win32 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a minimal test for g_spawn_async_with_pipes_and_fds() Signed-off-by: Marc-André Lureau --- glib/tests/spawn-singlethread.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/glib/tests/spawn-singlethread.c b/glib/tests/spawn-singlethread.c index 8dca847fa..7711ba8fe 100644 --- a/glib/tests/spawn-singlethread.c +++ b/glib/tests/spawn-singlethread.c @@ -27,10 +27,10 @@ #include #include #include +#include #ifdef G_OS_UNIX #include -#include #include #include #include @@ -433,7 +433,6 @@ test_spawn_nonexistent (void) static void test_spawn_fd_assignment_clash (void) { -#if defined(G_OS_UNIX) && defined(F_DUPFD_CLOEXEC) int tmp_fd; guint i; #define N_FDS 10 @@ -451,7 +450,12 @@ test_spawn_fd_assignment_clash (void) for (i = 0; i < (N_FDS - 1); ++i) { - int source = fcntl (tmp_fd, F_DUPFD_CLOEXEC, 3); + int source; +#ifdef F_DUPFD_CLOEXEC + source = fcntl (tmp_fd, F_DUPFD_CLOEXEC, 3); +#else + source = dup (tmp_fd); +#endif g_assert_cmpint (source, >=, 0); source_fds[i] = source; target_fds[i] = source + N_FDS; @@ -486,9 +490,6 @@ test_spawn_fd_assignment_clash (void) /* Clean up. */ for (i = 0; i < N_FDS; i++) g_close (source_fds[i], NULL); -#else /* !G_OS_UNIX */ - g_test_skip ("FD redirection only supported on Unix with F_DUPFD_CLOEXEC"); -#endif /* !G_OS_UNIX */ } int