X-Git-Url: https://git.draconx.ca/gitweb/cdecl99.git/blobdiff_plain/aba6fe8bda05659f70ef0cca07aa02db72f23315..4ef59e97312cf3e8f537643c65bc2fef057b786b:/t/rendertest.c diff --git a/t/rendertest.c b/t/rendertest.c index cd14229..00e0c59 100644 --- a/t/rendertest.c +++ b/t/rendertest.c @@ -27,6 +27,7 @@ #define PROGNAME "rendertest" #include "test.h" +#include "getline.h" static const char sopts[] = "n:ECVH"; static const struct option lopts[] = { @@ -125,12 +126,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 (do_getline(&line, &sz)) { if (do_test(line, n, mode) < 0) ret = EXIT_FAILURE; }