From: Mathieu Desnoyers Date: Fri, 3 Jun 2022 19:45:31 +0000 (-0400) Subject: Fix: remove non-async-signal-safe fflush from ERR() X-Git-Tag: v2.12.5~3 X-Git-Url: http://git.liburcu.org/?p=lttng-ust.git;a=commitdiff_plain;h=673f1ff39e7bf8f053836794192d936b79fc2b16 Fix: remove non-async-signal-safe fflush from ERR() Commit ff1fedb9f2e8 ("usterr: make error reporting functions signal safe") changed the logging printout mechanism to use patient_write() to a file descriptor to ensure signal-safety of the ERR() logging mechanism. However, the fflush(stderr) was left in place, although it was useless. Unfortunately, fflush() is not async-signal-safe. Fix this by removing this fflush() call. Signed-off-by: Mathieu Desnoyers Change-Id: I13754acd914c4a9f71014a1e332c3fb25197a669 --- diff --git a/include/usterr-signal-safe.h b/include/usterr-signal-safe.h index d987c1f0..6bab3632 100644 --- a/include/usterr-signal-safe.h +++ b/include/usterr-signal-safe.h @@ -85,7 +85,6 @@ do { \ ____buf[sizeof(____buf) - 1] = 0; \ patient_write(STDERR_FILENO, ____buf, strlen(____buf)); \ errno = ____saved_errno; /* signal-safety */ \ - fflush(stderr); \ } \ } while (0)