aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-07-21 05:03:46 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-07-24 18:15:17 +0200
commitbdccb3cd31a0214d20655b2ee511b07f2a184767 (patch)
tree696cc98726ffdfd490128f70ea8f01ee48508bd6 /src
parentembeddable-wg-library: do not left shift negative numbers (diff)
downloadwireguard-monolithic-historical-bdccb3cd31a0214d20655b2ee511b07f2a184767.tar.xz
wireguard-monolithic-historical-bdccb3cd31a0214d20655b2ee511b07f2a184767.zip
qemu: show log if process crashes
Diffstat (limited to 'src')
-rw-r--r--src/tests/qemu/init.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/tests/qemu/init.c b/src/tests/qemu/init.c
index 8d783e9..7db1d4b 100644
--- a/src/tests/qemu/init.c
+++ b/src/tests/qemu/init.c
@@ -111,17 +111,23 @@ static void enable_logging(void)
int fd;
pretty_message("[+] Enabling logging...");
fd = open("/proc/sys/kernel/printk", O_WRONLY);
- if (fd < 0)
- panic("open(printk)");
- if (write(fd, "9\n", 2) != 2)
- panic("write(printk)");
- close(fd);
+ if (fd >= 0) {
+ if (write(fd, "9\n", 2) != 2)
+ panic("write(printk)");
+ close(fd);
+ }
+ fd = open("/proc/sys/debug/exception-trace", O_WRONLY);
+ if (fd >= 0) {
+ if (write(fd, "1\n", 2) != 2)
+ panic("write(exception-trace)");
+ close(fd);
+ }
fd = open("/proc/sys/kernel/panic_on_warn", O_WRONLY);
- if (fd < 0)
- return; /* < 3.18 doesn't have it */
- if (write(fd, "1\n", 2) != 2)
- panic("write(panic_on_warn)");
- close(fd);
+ if (fd >= 0) {
+ if (write(fd, "1\n", 2) != 2)
+ panic("write(panic_on_warn)");
+ close(fd);
+ }
}
static void kmod_selftests(void)