Increase buffer for uncaught exception / std::terminate

Use PIPE_BUF over some magic number 1024 in terminate_handler, since
according to pipe(7):

    PIPE_BUF
           POSIX.1  says  that  write(2)s of less than PIPE_BUF bytes must be atomic

Also note that 1024, is too small, especially for C++ stacktraces (and
especially for debug builds, that contains lots of non-inlined helpers
for various ptrs).
This commit is contained in:
Azat Khuzhin 2021-02-19 22:42:40 +03:00
parent 3509fe88d8
commit 7474a7e3ca

View File

@ -416,7 +416,7 @@ static void sanitizerDeathCallback()
else
log_message = "Terminate called without an active exception";
static const size_t buf_size = 1024;
static const size_t buf_size = PIPE_BUF;
if (log_message.size() > buf_size - 16)
log_message.resize(buf_size - 16);