From ec97fc92821f52d03a75c55ec39f7ea77347b1d6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Mon, 9 Aug 2021 13:12:56 +0200 Subject: [PATCH] :art: Improve signals --- src/main.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main.c b/src/main.c index 024a69ba..d3a59b0f 100644 --- a/src/main.c +++ b/src/main.c @@ -6,13 +6,13 @@ #include "gwion.h" #include "arg.h" +static struct Gwion_ gwion = {}; + static void sig(int unused NUSED) { -//#ifdef BUILD_ON_WINDOWS - exit(EXIT_FAILURE); -//#else -// pthread_kill(pthread_self(), SIGKILL); -// pthread_exit(NULL); -//#endif + if(gwion.vm) + gwion.vm->bbq->is_running = false; + else + exit(EXIT_FAILURE); } #ifdef __AFL_HAVE_MANUAL_CONTROL @@ -31,7 +31,6 @@ static void afl_run(const Gwion gwion) { int main(int argc, char **argv) { Arg arg = {}; - struct Gwion_ gwion = {}; gwion_ini(&gwion, &arg); arg_release(&arg); afl_run(&gwion); -- 2.43.0