From eb6fb669f64aa3af2baf0e5cef5d46793fc97129 Mon Sep 17 00:00:00 2001 From: Petr Vorel Date: Tue, 20 Sep 2022 22:23:44 +0200 Subject: [PATCH 2/2] ping: Make ping_rts struct static This allows accessing global_rts->exiting in sigexit() signal handler after main() has exited. Problem occurred on aarch64, which occasionally delivered signal after main() has exited, which causes segfault. Fixes: b3a41a6 ("ping: move global variables to runtime config structure") Fixes: https://github.com/iputils/iputils/issues/423 Closes: https://github.com/iputils/iputils/pull/425 Reported-by: linzhanglong Suggested-by: Cyril Hrubis Reviewed-by: Cyril Hrubis Signed-off-by: Petr Vorel [ upstream status: https://github.com/iputils/iputils/commit/7861af993bf47fccaf37c5659d66c09832844ae3 ] --- ping/ping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ping/ping.c b/ping/ping.c index 7a27b63..176410a 100644 --- a/ping/ping.c +++ b/ping/ping.c @@ -267,7 +267,7 @@ main(int argc, char **argv) socket_st sock6 = { .fd = -1 }; char *target; char *outpack_fill = NULL; - struct ping_rts rts = { + static struct ping_rts rts = { .interval = 1000, .preload = 1, .lingertime = MAXWAIT * 1000, -- 2.37.3