summaryrefslogtreecommitdiff
path: root/lib/printf_test.c
diff options
context:
space:
mode:
authorPetr Vaněk <arkamar@atlas.cz>2023-03-06 11:19:30 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2023-03-06 11:33:27 +0100
commit0f679438f36d8c2a31dfe490007e983b085caef6 (patch)
treebb64f011f6e8ec98d6cf9b4bb0d6511da25d8166 /lib/printf_test.c
parent2f080b543296aa2fa18bf7451b5174d942b0a952 (diff)
Printf test suite fails on systems with musl libc because tests for "%m"
and "%M" formats expect "Input/output error" message but musl returns "I/O error". Proposed change compares the printf output with string returned from strerror function for EIO constant. See-also: https://bugs.gentoo.org/836713 Minor change from committer.
Diffstat (limited to 'lib/printf_test.c')
-rw-r--r--lib/printf_test.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/printf_test.c b/lib/printf_test.c
index 47ea905d..88ecf05e 100644
--- a/lib/printf_test.c
+++ b/lib/printf_test.c
@@ -32,11 +32,14 @@ t_simple(void)
BSPRINTF(1, "@", buf, "@", 64);
BSPRINTF(1, "\xff", buf, "%c", 0xff);
- errno = 5;
- BSPRINTF(18, "Input/output error", buf, "%m");
+ const char *io_error_str = lp_strdup(tmp_linpool, strerror(EIO));
+ const int io_error_len = strlen(io_error_str);
+
+ errno = EIO;
+ BSPRINTF(io_error_len, io_error_str, buf, "%m");
errno = 0;
- BSPRINTF(18, "Input/output error", buf, "%M", 5);
+ BSPRINTF(io_error_len, io_error_str, buf, "%M", EIO);
BSPRINTF(11, "TeSt%StRiNg", buf, "%s", "TeSt%StRiNg");