From c4e6888fd9f770fa890e45b7d34cff6ca56e58c2 Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Tue, 3 Sep 2013 16:44:33 +0200 Subject: [PATCH] Thread-secure psignal(3). --- libc/signal/psignal.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libc/signal/psignal.cpp b/libc/signal/psignal.cpp index ba065d53..eb4632e4 100644 --- a/libc/signal/psignal.cpp +++ b/libc/signal/psignal.cpp @@ -28,7 +28,9 @@ extern "C" void psignal(int signum, const char* message) { + flockfile(stderr); if ( message && message[0] ) - fprintf(stderr, "%s: ", message); - fprintf(stderr, strsignal(signum)); + fprintf_unlocked(stderr, "%s: ", message); + fprintf_unlocked(stderr, strsignal(signum)); + funlockfile(stderr); }