}
}
- 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;
}