diff --git a/src/snmalloc/pal/pal_posix.h b/src/snmalloc/pal/pal_posix.h index f71755d..58b3c1f 100644 --- a/src/snmalloc/pal/pal_posix.h +++ b/src/snmalloc/pal/pal_posix.h @@ -163,6 +163,9 @@ namespace snmalloc */ static void message(const char* const str) noexcept { + // We don't want logging to affect the errno behaviour of the program. + auto hold = KeepErrno(); + void* nl = const_cast("\n"); struct iovec iov[] = {{const_cast(str), strlen(str)}, {nl, 1}}; UNUSED(writev(STDERR_FILENO, iov, sizeof(iov) / sizeof(struct iovec)));