Fix: remove non-async-signal-safe fflush from ERR()
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 3 Jun 2022 19:45:31 +0000 (15:45 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 3 Jun 2022 19:45:31 +0000 (15:45 -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

include/usterr-signal-safe.h

index d987c1f0a11009788eaf0672450afb0736f61014..6bab363261cd02da099380120b2cf7b9af05a99d 100644 (file)
@@ -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)
 
This page took 0.025209 seconds and 4 git commands to generate.