]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - gui.c
gui: Check stdin for readability.
[paraslash.git] / gui.c
diff --git a/gui.c b/gui.c
index a4ee72758d6944cbd28aa8476049268ebb762256..9ac24ab6baddb74f8a991d770dedf609546bae09 100644 (file)
--- a/gui.c
+++ b/gui.c
@@ -951,7 +951,7 @@ static int open_stat_pipe(void)
        return ret;
 }
 
-#define COMMAND_BUF_SIZE 4096
+#define COMMAND_BUF_SIZE 32768
 
 /*
  * This is the core select loop. Besides the (internal) signal
@@ -993,6 +993,8 @@ repeat:
                if (command_fds[1] >= 0)
                        para_fd_set(command_fds[1], &rfds, &max_fileno);
        }
+       if (mode == GETCH_MODE || mode == COMMAND_MODE)
+               para_fd_set(STDIN_FILENO, &rfds, &max_fileno);
        ret = para_select(max_fileno + 1, &rfds, NULL, &tv);
        if (ret <= 0)
                goto check_return; /* skip fd checks */
@@ -1023,6 +1025,10 @@ repeat:
                                if (command_fds[!i] < 0) /* both fds closed */
                                        return 0;
                        }
+                       if (cbo[i] == COMMAND_BUF_SIZE - 1) {
+                               PARA_NOTICE_LOG("discarding overlong line");
+                               cbo[i] = 0;
+                       }
                }
        }
        ret = read_stat_pipe(&rfds);