summaryrefslogtreecommitdiff
path: root/tests/test-execute-child.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-execute-child.c')
-rw-r--r--tests/test-execute-child.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/test-execute-child.c b/tests/test-execute-child.c
index dbaae1e962..481e50f348 100644
--- a/tests/test-execute-child.c
+++ b/tests/test-execute-child.c
@@ -41,6 +41,7 @@ is_device (int fd)
/* Now include the other header files. */
#include <fcntl.h>
#include <signal.h>
+#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@@ -57,6 +58,7 @@ is_device (int fd)
/* In this file, we use only system functions, no overrides from gnulib. */
#undef atoi
+#undef close
#undef fcntl
#undef fflush
#undef fgetc
@@ -64,13 +66,18 @@ is_device (int fd)
#undef fputs
#undef getcwd
#undef isatty
+#undef open
#undef raise
#undef read
#undef sprintf
+#undef strcasestr
#undef strcmp
#undef strlen
+#undef strstr
#undef write
+#include "qemu.h"
+
#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
static void __cdecl
gl_msvc_invalid_parameter_handler (const wchar_t *expression,
@@ -166,12 +173,15 @@ main (int argc, char *argv[])
_set_invalid_parameter_handler (gl_msvc_invalid_parameter_handler);
#endif
{
+ /* QEMU 6.1 in user-mode passes an open fd = 3, that references
+ /dev/urandom. We need to ignore this fd. */
+ bool is_qemu = is_running_under_qemu_user ();
char buf[300];
buf[0] = '\0';
char *p = buf;
int fd;
for (fd = 0; fd < 20; fd++)
- if (is_open (fd))
+ if (is_open (fd) && !(is_qemu && fd == 3))
{
sprintf (p, "%d ", fd);
p += strlen (p);