X-Git-Url: https://git.draconx.ca/gitweb/cdecl99.git/blobdiff_plain/aba6fe8bda05659f70ef0cca07aa02db72f23315..481f693b0400b05586d90f60494e0e661ad8a1c1:/t/rendertest.c diff --git a/t/rendertest.c b/t/rendertest.c index cd14229..e64526f 100644 --- a/t/rendertest.c +++ b/t/rendertest.c @@ -125,12 +125,12 @@ int main(int argc, char **argv) } } - line = malloc_nofail((sz = n+1)); - while (getline(&line, &sz, stdin) >= 0) { - char *c = strchr(line, '\n'); - if (c) - *c = '\0'; - + /* + * Ensure the preallocated buffer is more than one byte, otherwise we + * will hit a bug in AIX 7.2 getline and fall into an infinite loop. + */ + line = malloc_nofail((sz = MAX(n+1, 10))); + while (test_getline(&line, &sz)) { if (do_test(line, n, mode) < 0) ret = EXIT_FAILURE; }