Fix: remove non-async-signal-safe fflush from ERR()
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 6 Apr 2022 14:17:15 +0000 (10:17 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 3 Jun 2022 19:44:17 +0000 (15:44 -0400)
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 <mathieu.desnoyers@efficios.com>
Change-Id: I13754acd914c4a9f71014a1e332c3fb25197a669

src/common/logging.h

index c98644d87c8128c3caf2debe0e841f830c82ba22..e8762c69bdc5d01d3b363e07eb7452a859e6d9eb 100644 (file)
@@ -126,7 +126,6 @@ do {                                                                        \
                ____buf[sizeof(____buf) - 1] = 0;                       \
                ust_patient_write(STDERR_FILENO, ____buf, strlen(____buf)); \
                errno = ____saved_errno;        /* signal-safety */     \
-               fflush(stderr);                                         \
        }                                                               \
 } while (0)
 
This page took 0.025513 seconds and 4 git commands to generate.