]> granicus.if.org Git - jq/commitdiff
Fix infinite loop in read_more() (fix #656)
authorNicolas Williams <nico@cryptonector.com>
Wed, 24 Dec 2014 22:48:39 +0000 (16:48 -0600)
committerNicolas Williams <nico@cryptonector.com>
Wed, 24 Dec 2014 22:49:55 +0000 (16:49 -0600)
main.c

diff --git a/main.c b/main.c
index 0d32cb0bc0326a59f9403a21893e3b15ad37e3ab..2d022bb3d92353a0625da13e8bc7bc5e7bf8e098 100644 (file)
--- a/main.c
+++ b/main.c
@@ -154,7 +154,7 @@ const char** input_filenames = NULL;
 int ninput_files;
 int next_input_idx;
 static int read_more(char* buf, size_t size) {
-  while (!current_input || feof(current_input)) {
+  if (!current_input || feof(current_input)) {
     if (current_input) {
       if (current_input == stdin) {
         clearerr(stdin); // perhaps we can read again; anyways, we don't fclose(stdin)