diff options
author | teor <teor@torproject.org> | 2019-08-30 21:17:56 +1000 |
---|---|---|
committer | teor <teor@torproject.org> | 2019-08-30 21:51:11 +1000 |
commit | c55591825fedb0fe1db92fab7b654ccc15ad50d3 (patch) | |
tree | 10d905ea899aff0e4cfad56c2ca4da2a6c3d7050 /src/lib/err/torerr.c | |
parent | 65a1d86491d56c77048d01e0b4fc6b933a13795c (diff) | |
download | tor-c55591825fedb0fe1db92fab7b654ccc15ad50d3.tar.gz tor-c55591825fedb0fe1db92fab7b654ccc15ad50d3.zip |
torerr: Try harder to flush raw assert messages before process termination
Some platforms (macOS, maybe others?) can swallow the last write before an
abort. This issue is probably caused by a race condition between write
buffer cache flushing, and process termination. So we write an extra
newline, to make sure that the message always gets through.
Fixes bug 31571; bugfix on 0.3.5.1-alpha.
Diffstat (limited to 'src/lib/err/torerr.c')
-rw-r--r-- | src/lib/err/torerr.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib/err/torerr.c b/src/lib/err/torerr.c index 88b19b7327..6b5224273a 100644 --- a/src/lib/err/torerr.c +++ b/src/lib/err/torerr.c @@ -146,13 +146,19 @@ tor_raw_assertion_failed_msg_(const char *file, int line, const char *expr, format_dec_number_sigsafe(line, linebuf, sizeof(linebuf)); tor_log_err_sigsafe("INTERNAL ERROR: Raw assertion failed in ", get_tor_backtrace_version(), " at ", - file, ":", linebuf, ": ", expr, NULL); + file, ":", linebuf, ": ", expr, "\n", NULL); if (msg) { tor_log_err_sigsafe_write(msg); tor_log_err_sigsafe_write("\n"); } dump_stack_symbols_to_error_fds(); + + /* Some platforms (macOS, maybe others?) can swallow the last write before an + * abort. This issue is probably caused by a race condition between write + * buffer cache flushing, and process termination. So we write an extra + * newline, to make sure that the message always gets through. */ + tor_log_err_sigsafe_write("\n"); } /* As format_{hex,dex}_number_sigsafe, but takes a <b>radix</b> argument |