]> git.draconx.ca Git - cdecl99.git/blobdiff - t/rendertest.c
Port to use getline.h from dxcommon.
[cdecl99.git] / t / rendertest.c
index cd142298e6b43fef345913453b8311f56c9cbd12..e64526feb84d5f2a8bdac4b9acdb44177c3cb5dd 100644 (file)
@@ -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;
        }