diff options
author | Maria Matejka <mq@ucw.cz> | 2019-10-04 12:20:02 +0200 |
---|---|---|
committer | Maria Matejka <mq@jmq.cz> | 2019-10-04 20:52:07 +0200 |
commit | 24493e9169d3058958ab3ec4d2b02c5753954981 (patch) | |
tree | c50c972dc4b0362ca77d9887ddc93a3372036653 /sysdep/unix/unix.h | |
parent | 4821251ebb13c05e8752f6f54b8e5ad6d87fecaa (diff) |
Fixed undefined behavior on signals.
The C11 specification allows only sig_atomic_t and _Atomic variable
access. All other accesses to global variables are undefined behavior.
Using int was probably OK on x86 and x86_64; yet there were some reports
from other architectures (especially some MIPS) that in rare cases,
after issuing SIGHUP, BIRD did strange things.
Diffstat (limited to 'sysdep/unix/unix.h')
-rw-r--r-- | sysdep/unix/unix.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sysdep/unix/unix.h b/sysdep/unix/unix.h index bf0aedeb..bd817bf2 100644 --- a/sysdep/unix/unix.h +++ b/sysdep/unix/unix.h @@ -10,6 +10,7 @@ #define _BIRD_UNIX_H_ #include <sys/socket.h> +#include <signal.h> struct pool; struct iface; @@ -97,9 +98,9 @@ int sockaddr_read(sockaddr *sa, int af, ip_addr *a, struct iface **ifa, uint *po #define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) + strlen ((ptr)->sun_path)) #endif -extern volatile int async_config_flag; -extern volatile int async_dump_flag; -extern volatile int async_shutdown_flag; +extern volatile sig_atomic_t async_config_flag; +extern volatile sig_atomic_t async_dump_flag; +extern volatile sig_atomic_t async_shutdown_flag; void io_init(void); void io_loop(void); |