aboutsummaryrefslogtreecommitdiff
path: root/src/lib/log/util_bug.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/log/util_bug.c')
-rw-r--r--src/lib/log/util_bug.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/log/util_bug.c b/src/lib/log/util_bug.c
index af1ac40732..581ae85f47 100644
--- a/src/lib/log/util_bug.c
+++ b/src/lib/log/util_bug.c
@@ -1,6 +1,6 @@
/* Copyright (c) 2003, Roger Dingledine
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
- * Copyright (c) 2007-2019, The Tor Project, Inc. */
+ * Copyright (c) 2007-2020, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
@@ -163,7 +163,8 @@ tor_bug_occurred_(const char *fname, unsigned int line,
/**
* Call the tor_raw_abort_() function to close raw logs, then kill the current
- * process with a fatal error.
+ * process with a fatal error. But first, close the file-based log file
+ * descriptors, so error messages are written before process termination.
*
* (This is a separate function so that we declare it in util_bug.h without
* including torerr.h in all the users of util_bug.h)
@@ -171,6 +172,7 @@ tor_bug_occurred_(const char *fname, unsigned int line,
void
tor_abort_(void)
{
+ logs_flush_sigsafe();
tor_raw_abort_();
}