diff options
author | Maria Matejka <mq@ucw.cz> | 2021-12-01 10:46:49 +0100 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2021-12-01 13:00:54 +0100 |
commit | 55ee9961e0d130bb16b22b7b5acffd815f266d63 (patch) | |
tree | 2b5f9c0a572871bbe5cbc8ff3f07bd13915b104c /sysdep/unix/main.c | |
parent | bb63e99d7877023667edaf26495dd657ec2fd57b (diff) |
Fix of shutdown: premature log cleanup led to use-after-free
Diffstat (limited to 'sysdep/unix/main.c')
-rw-r--r-- | sysdep/unix/main.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sysdep/unix/main.c b/sysdep/unix/main.c index 57c51c99..c326ba2b 100644 --- a/sysdep/unix/main.c +++ b/sysdep/unix/main.c @@ -202,7 +202,9 @@ sysdep_preconfig(struct config *c) int sysdep_commit(struct config *new, struct config *old UNUSED) { - log_switch(0, &new->logfiles, new->syslog_name); + if (!new->shutdown) + log_switch(0, &new->logfiles, new->syslog_name); + return 0; } @@ -613,6 +615,7 @@ sysdep_shutdown_done(void) unlink_pid_file(); unlink(path_control_socket); log_msg(L_FATAL "Shutdown completed"); + log_cleanup(1); exit(0); } |