musl-legacy-compat: add fflush call to error().

The testsuite for elfutils expects things printed to stdout before
calling error() to appear before the error message; glibc implements
this by calling fflush(stdout) after checking the stream is still valid.
Here, we will simply flush all output streams.
This commit is contained in:
Érico Rolim 2021-02-08 19:47:17 -03:00 committed by Érico Nogueira Rolim
parent a8cbda5f97
commit 900bdf655b
2 changed files with 5 additions and 1 deletions

View file

@ -13,6 +13,10 @@ static unsigned int error_message_count = 0;
static inline void error(int status, int errnum, const char* format, ...)
{
/* should be fflush(stdout), but that's unspecified if stdout has been closed;
* stick with fflush(NULL) for simplicity (glibc checks if the fd is still valid) */
fflush(NULL);
va_list ap;
fprintf(stderr, "%s: ", program_invocation_name);
va_start(ap, format);

View file

@ -1,7 +1,7 @@
# Template file for 'musl-legacy-compat'
pkgname=musl-legacy-compat
version=0.4
revision=1
revision=2
archs="*-musl"
bootstrap=yes
short_desc="Legacy compatibility headers for the musl libc"