Return-Path: From: Sven Eckelmann Date: Mon, 19 May 2014 13:50:08 +0200 Message-Id: <1400500208-4250-1-git-send-email-sven@narfation.org> Subject: [B.A.T.M.A.N.] [PATCH] batctl: Avoid overoptimization of signal related check Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: b.a.t.m.a.n@lists.open-mesh.org Cc: Sven Eckelmann 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 --- 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) -- 2.0.0.rc2