Skip to contentSkip to conversation

samples/sockmap: Make signal handling safer

PATCH New SF Markus Elfring 1 participant 1 message Nov 9, 2017 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 samples/sockmap: Make signal handling safer

From: Markus Elfring <[email protected]>
Date: Thu, 9 Nov 2017 15:06:16 +0100

Use the data type "sig_atomic_t" for the variable "running" so that it can be safely modified by a signal handler.

Fixes 69e8cc134bcbf0ccfcf852c400b8e6788d1d0038 ("bpf: sockmap sample program")
---
 samples/sockmap/sockmap_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
samples/sockmap/sockmap_user.c +1 -1
index 7cc9d228216f..6e3ebbb1f8f4 100644
@@ -39,7 +39,7 @@
 #include "../bpf/bpf_util.h"
 #include "../bpf/libbpf.h"
 
-int running;
+static sig_atomic_t running;
 void running_handler(int a);
 
 /* randomly selected ports for testing on lo */
Signature · 1 line
2.15.0