diff --git a/hermit/tools/proxy.c b/hermit/tools/proxy.c index 47c4595a5..ac08d6a6c 100644 --- a/hermit/tools/proxy.c +++ b/hermit/tools/proxy.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -67,6 +68,11 @@ static void fini_env(void) unlink(fname); } +static void exit_handler(int sig) +{ + exit(0); +} + static int init_env(void) { int j, fd; @@ -75,6 +81,25 @@ static int init_env(void) FILE* file; char isle_path[MAX_PATH]; char* result; + struct sigaction sINT, sTERM; + + /* define action for SIGINT */ + sINT.sa_handler = exit_handler; + sINT.sa_flags = 0; + if (sigaction(SIGINT, &sINT, NULL) < 0) + { + perror("sigaction"); + exit(1); + } + + /* define action for SIGTERM */ + sTERM.sa_handler = exit_handler; + sTERM.sa_flags = 0; + if (sigaction(SIGTERM, &sTERM, NULL) < 0) + { + perror("sigaction"); + exit(1); + } str = getenv("HERMIT_ISLE"); if (str)