diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-11-05 14:34:00 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-11-05 14:34:00 +0100 |
commit | d2de8b0862a7fbb51a7f2f958d58f0efe4648259 (patch) | |
tree | 12cdffa91fdc97d3a2409141f70276a022ad0938 /src/tests | |
parent | compat: fix variable assumptions (diff) | |
download | wireguard-monolithic-historical-d2de8b0862a7fbb51a7f2f958d58f0efe4648259.tar.xz wireguard-monolithic-historical-d2de8b0862a7fbb51a7f2f958d58f0efe4648259.zip |
qemu: work around termio race condition
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/qemu/init.c | 7 |
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(); |