commit dd0091f98422624598584141c5b51431974e3b5d
parent 36deef4e0b743790bc4e445d3272189be997b508
Author: Brian Swetland <swetland@frotz.net>
Date:   Sun, 21 Jun 2015 21:48:01 -0700
linenoise: really fix the bug this time
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/linenoise.c b/tools/linenoise.c
@@ -775,14 +775,14 @@ ssize_t linenoiseRead(struct linenoiseState *l, void *ptr, int len) {
         fds[0].fd = l->ifd;
         fds[0].events = POLLIN;
         fds[0].revents = 0;
+        fds[1].revents = 0;
         if (linenoise_pipefds[0] < 0) {
-            nfds = 2;
+            nfds = 1;
+        } else {
             fds[1].fd = linenoise_pipefds[0];
             fds[1].events = POLLIN;
-        } else {
-            nfds = 1;
+            nfds = 2;
         }
-        fds[1].revents = 0;
 
         /* wait for input or refresh request */
         pthread_mutex_unlock(&linenoise_lock);