]> git.draconx.ca Git - cdecl99.git/blobdiff - t/rendertest.c
Avoid gnulib getline module.
[cdecl99.git] / t / rendertest.c
index cd142298e6b43fef345913453b8311f56c9cbd12..00e0c59f0a7981e4d5f2b3cdc32280b4961cfc25 100644 (file)
@@ -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;
        }