gui: Reset command buf offset on errors.
authorAndre Noll <maan@systemlinux.org>
Fri, 3 Jan 2014 23:42:38 +0000 (23:42 +0000)
committerAndre Noll <maan@systemlinux.org>
Sun, 4 May 2014 12:04:04 +0000 (14:04 +0200)
On read errors or EOF we close the pipe that corresponds to
stdout/stderr of the current display command. However, we miss to
reset the offset value of the command buffer in this case. If this
offset was positive at the time the read error occurred, we skip the
first part of the output of the next command.

Fix this by always resetting the offset after closing the pipe.

gui.c

diff --git a/gui.c b/gui.c
index 716e299..2a0174b 100644 (file)
--- a/gui.c
+++ b/gui.c
@@ -1054,6 +1054,7 @@ repeat:
                                close(command_fds[i]);
                                command_fds[i] = -1;
                                flags[i] = 0;
                                close(command_fds[i]);
                                command_fds[i] = -1;
                                flags[i] = 0;
+                               cbo[i] = 0;
                                if (command_fds[!i] < 0) /* both fds closed */
                                        return 0;
                        }
                                if (command_fds[!i] < 0) /* both fds closed */
                                        return 0;
                        }