Ensure logging doesn't affect errno
This commit is contained in:
committed by
Matthew Parkinson
parent
14b7b40a82
commit
9f9964239e
@@ -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<char*>("\n");
|
||||
struct iovec iov[] = {{const_cast<char*>(str), strlen(str)}, {nl, 1}};
|
||||
UNUSED(writev(STDERR_FILENO, iov, sizeof(iov) / sizeof(struct iovec)));
|
||||
|
||||
Reference in New Issue
Block a user