Repository : ssh://git@open-mesh.org/batctl
On branch : master
---------------------------------------------------------------
commit 210e84eb50637f8d1eee73b01c87ca886decc5a2
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Sun Jan 22 13:07:48 2017 +0100
batctl: ping: Use sig_atomic_t variable to stop ping
The variable used in the signal handlers of ping is currently only a
char. It is shared with the main routine which checks if the ping should be
stopped or not. But the standard defines that such a variable must be
volatile sig_atomic_t or a lock-free atomic object.
The volatile definition avoids that the compiler must not assume that this
object can be cached. sig_atomic_t will make sure that this object is
atomically accessible in asynchronous interrupts. Not using these types
could result in an "unstoppable" ping.
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
Signed-off-by: Simon Wunderlich <sw(a)simonwunderlich.de>
---------------------------------------------------------------
210e84eb50637f8d1eee73b01c87ca886decc5a2
ping.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ping.c b/ping.c
index 4fef663..7e5c6fc 100644
--- a/ping.c
+++ b/ping.c
@@ -45,7 +45,7 @@
#include "icmp_helper.h"
-char is_aborted = 0;
+static volatile sig_atomic_t is_aborted = 0;
static void ping_usage(void)