From: Miroslav Lichvar Date: Wed, 17 Mar 2021 08:21:42 +0000 (+0100) Subject: declare variables set from signal handlers as volatile X-Git-Tag: 4.1-pre1~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3812ec2aa277ea65258ff4c5eb501e1e2b1f1b2f;p=thirdparty%2Fchrony.git declare variables set from signal handlers as volatile Make sure variables set from signal handlers are not cached in registers. --- diff --git a/client.c b/client.c index b5f0b54a..c0e90220 100644 --- a/client.c +++ b/client.c @@ -61,7 +61,7 @@ static ARR_Instance server_addresses; static int sock_fd = -1; -static int quit = 0; +static volatile int quit = 0; static int on_terminal = 0; diff --git a/sched.c b/sched.c index a4487c39..1f5ebe41 100644 --- a/sched.c +++ b/sched.c @@ -111,7 +111,8 @@ static struct timespec last_class_dispatch[SCH_NumberOfClasses]; /* ================================================== */ -static int need_to_exit; +/* Flag terminating the main loop, which can be set from a signal handler */ +static volatile int need_to_exit; /* ================================================== */