commit 437728beacff833edd64de96c6e9548cbd0fa813 parent 061d0a9a9503727b7e23c30abfcd6605db99591d Author: Roberto E. Vargas Caballero <k0ga@shike2.com> Date: Fri, 4 May 2018 13:39:06 +0100 [ar] Remove temporary files in signal handler Remove(3) cannot be called in the context of a signal handler, but it is the only interface that we have in C99 to remove a file. Diffstat:
M | ar/main.c | | | 9 | ++++++++- |
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/ar/main.c b/ar/main.c @@ -50,10 +50,17 @@ cleanup(void) } } +/* + * I do know that you cannot call remove from a signal handler + * but we only can use stdio function to deal with files + * because we are C99 compliant, and it is very likely that + * remove is going to work in this case + */ static void sigfun(int signum) { - exit(1); + cleanup(); + _Exit(1); } static FILE *