]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
declare variables set from signal handlers as volatile
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 17 Mar 2021 08:21:42 +0000 (09:21 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Thu, 18 Mar 2021 16:38:18 +0000 (17:38 +0100)
Make sure variables set from signal handlers are not cached in
registers.

client.c
sched.c

index b5f0b54a6a8c49cb3b9d673052dcf8b6e8155c80..c0e902200701f05cb0ea7adcc22f1f7e8a00d742 100644 (file)
--- 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 a4487c39289ac7fcc858e4ad267e9d99e9205596..1f5ebe410b0cdafea8c52424677fa87a3d6849b0 100644 (file)
--- 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;
 
 /* ================================================== */