summaryrefslogtreecommitdiffhomepage
path: root/src/tests/qemu/init.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2016-11-05 14:34:00 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2016-11-05 14:34:00 +0100
commita547e04ea89ab4bd0b35647a22ee90c0b0d39c4c (patch)
tree8d52a9d4951f6a277de5b1b8b237c9e43b0dd0a3 /src/tests/qemu/init.c
parent0b83d4c71a812f50120029af1f833c1ea8954b5c (diff)
qemu: work around termio race condition
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/tests/qemu/init.c')
-rw-r--r--src/tests/qemu/init.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/tests/qemu/init.c b/src/tests/qemu/init.c
index 4af220c..5185a4e 100644
--- a/src/tests/qemu/init.c
+++ b/src/tests/qemu/init.c
@@ -13,6 +13,7 @@
#include <sys/types.h>
#include <sys/io.h>
#include <sys/ioctl.h>
+#include <sys/reboot.h>
#include <sys/utsname.h>
#include <linux/random.h>
#include <linux/version.h>
@@ -167,9 +168,13 @@ static bool linux_4_8_or_higher(const struct utsname *utsname)
int main(int argc, char *argv[])
{
struct utsname utsname;
+
+ /* Work around nasty QEMU/kernel race condition. */
+ if (write(1, NULL, 0) < 0)
+ reboot(RB_AUTOBOOT);
+
if (uname(&utsname) < 0)
panic("uname");
-
print_banner(&utsname);
mount_filesystems();
kmod_selftests();