mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-08 12:18:42 +00:00
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.
This commit is contained in:
parent
4821251ebb
commit
24493e9169
@ -2154,10 +2154,6 @@ watchdog_stop(void)
|
|||||||
* Main I/O Loop
|
* Main I/O Loop
|
||||||
*/
|
*/
|
||||||
|
|
||||||
volatile int async_config_flag; /* Asynchronous reconfiguration/dump scheduled */
|
|
||||||
volatile int async_dump_flag;
|
|
||||||
volatile int async_shutdown_flag;
|
|
||||||
|
|
||||||
void
|
void
|
||||||
io_init(void)
|
io_init(void)
|
||||||
{
|
{
|
||||||
|
@ -601,9 +601,9 @@ cmd_graceful_restart(void)
|
|||||||
* Signals
|
* Signals
|
||||||
*/
|
*/
|
||||||
|
|
||||||
volatile int async_config_flag;
|
volatile sig_atomic_t async_config_flag;
|
||||||
volatile int async_dump_flag;
|
volatile sig_atomic_t async_dump_flag;
|
||||||
volatile int async_shutdown_flag;
|
volatile sig_atomic_t async_shutdown_flag;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_sighup(int sig UNUSED)
|
handle_sighup(int sig UNUSED)
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#define _BIRD_UNIX_H_
|
#define _BIRD_UNIX_H_
|
||||||
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
struct pool;
|
struct pool;
|
||||||
struct iface;
|
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))
|
#define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) + strlen ((ptr)->sun_path))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern volatile int async_config_flag;
|
extern volatile sig_atomic_t async_config_flag;
|
||||||
extern volatile int async_dump_flag;
|
extern volatile sig_atomic_t async_dump_flag;
|
||||||
extern volatile int async_shutdown_flag;
|
extern volatile sig_atomic_t async_shutdown_flag;
|
||||||
|
|
||||||
void io_init(void);
|
void io_init(void);
|
||||||
void io_loop(void);
|
void io_loop(void);
|
||||||
|
@ -36,6 +36,11 @@ static int no_fork;
|
|||||||
static int no_timeout;
|
static int no_timeout;
|
||||||
static int is_terminal; /* Whether stdout is a live terminal or pipe redirect */
|
static int is_terminal; /* Whether stdout is a live terminal or pipe redirect */
|
||||||
|
|
||||||
|
volatile sig_atomic_t async_config_flag; /* Asynchronous reconfiguration/dump scheduled */
|
||||||
|
volatile sig_atomic_t async_dump_flag;
|
||||||
|
volatile sig_atomic_t async_shutdown_flag;
|
||||||
|
|
||||||
|
|
||||||
uint bt_verbose;
|
uint bt_verbose;
|
||||||
const char *bt_filename;
|
const char *bt_filename;
|
||||||
const char *bt_test_id;
|
const char *bt_test_id;
|
||||||
|
Loading…
Reference in New Issue
Block a user