From d61c4548f322b6cf26a18c2a14b16ca47a62e098 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 5 Jul 2026 14:13:35 -0400 Subject: [PATCH] main.c: just say "no" in the suffix test result --- main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index dc47500..238ddd1 100644 --- a/main.c +++ b/main.c @@ -1,6 +1,7 @@ #include #include #include +#include #include /* The various invalid sequences can be inferred from the table of @@ -97,15 +98,17 @@ int _my_iconv_close(iconv_t* cd) { */ int test_iconv_open_supports_suffix(const char* suffix) { const char* fromcode = "ASCII"; - char tocode[64] = "ASCII"; + char* tocode = malloc(strlen(fromcode) + strlen(suffix) + 1); + strcat(tocode, fromcode); strcat(tocode, suffix); printf("iconv_open() supports %s suffix...", suffix); iconv_t cd = iconv_open(tocode, fromcode); + free(tocode); if (cd == (iconv_t)(-1)) { switch (errno) { case EINVAL: - printf("OK (EINVAL, not supported)\n"); + printf("no\n"); return UNSUPPORTED; default: printf("FAIL (errno=%d, unexpected error)\n", errno); -- 2.53.0