According to C99, it is not safe to use a simple char for checks because the compiler may optimizes it away when it only gets modified in a signal handler. It is also undefined when the signal is modifying an object with static storage duration not from type volatile sig_atomic_t.
Signed-off-by: Sven Eckelmann sven@narfation.org --- ping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ping.c b/ping.c index c52ad13..bc5184d 100644 --- a/ping.c +++ b/ping.c @@ -44,7 +44,7 @@ #include "debugfs.h"
-char is_aborted = 0; +static volatile sig_atomic_t is_aborted = 0;
static void ping_usage(void)
b.a.t.m.a.n@lists.open-mesh.org