From 900bdf655b42e7d9cb016128d1242504200ba4db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Rolim?= Date: Mon, 8 Feb 2021 19:47:17 -0300 Subject: [PATCH] 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. --- srcpkgs/musl-legacy-compat/files/error.h | 4 ++++ srcpkgs/musl-legacy-compat/template | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/srcpkgs/musl-legacy-compat/files/error.h b/srcpkgs/musl-legacy-compat/files/error.h index 4505784182a..835d0cb7f7d 100644 --- a/srcpkgs/musl-legacy-compat/files/error.h +++ b/srcpkgs/musl-legacy-compat/files/error.h @@ -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); diff --git a/srcpkgs/musl-legacy-compat/template b/srcpkgs/musl-legacy-compat/template index afc447314f4..a59d4e7683f 100644 --- a/srcpkgs/musl-legacy-compat/template +++ b/srcpkgs/musl-legacy-compat/template @@ -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"