From f0dbdeb72e233c9a399804a6bc5aa9eee3019a3f Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Thu, 15 Aug 2002 06:53:44 +0000 Subject: [PATCH] * subshell.c (read_subshell_prompt): Remove argument "how", it's never set to VISIBLY. Adjust all dependencies. Eliminate hack with "clear_now" - it causes invalid memory access and hides the real problem. * util.c (strip_ctrl_codes): Fix possible invalid memory access if the escape sequence ends unexpectedly. --- src/ChangeLog | 9 +++++++++ src/main.c | 2 +- src/subshell.c | 12 ++---------- src/subshell.h | 2 +- src/util.c | 25 ++++++++++++++++++------- 5 files changed, 31 insertions(+), 19 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 148f54ca5..8f2d768db 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2002-08-15 Pavel Roskin + + * subshell.c (read_subshell_prompt): Remove argument "how", it's + never set to VISIBLY. Adjust all dependencies. Eliminate hack + with "clear_now" - it causes invalid memory access and hides the + real problem. + * util.c (strip_ctrl_codes): Fix possible invalid memory access + if the escape sequence ends unexpectedly. + 2002-08-14 Pavel Roskin * dir.c (do_load_dir): Fix leaking of file descriptors - always diff --git a/src/main.c b/src/main.c index fe4e1c557..7a4e0ca2a 100644 --- a/src/main.c +++ b/src/main.c @@ -1006,7 +1006,7 @@ directory_history_list (WPanel * panel) int load_prompt (int fd, void *unused) { - if (!read_subshell_prompt (QUIETLY)) + if (!read_subshell_prompt ()) return 0; /* Don't actually change the prompt if it's invisible */ diff --git a/src/subshell.c b/src/subshell.c index d8194a8c1..008287e2e 100644 --- a/src/subshell.c +++ b/src/subshell.c @@ -610,11 +610,10 @@ int invoke_subshell (const char *command, int how, char **new_dir) /* }}} */ /* {{{ read_subshell_prompt */ -int read_subshell_prompt (int how) +int read_subshell_prompt (void) { /* {{{ Local variables */ - int clear_now = FALSE; static int prompt_size = INITIAL_PROMPT_SIZE; int bytes = 0, i, rc = 0; struct timeval timeleft = {0, 0}; @@ -650,17 +649,13 @@ int read_subshell_prompt (int how) /* }}} */ bytes = read (subshell_pty, pty_buffer, pty_buffer_size); - if (how == VISIBLY) - write (STDOUT_FILENO, pty_buffer, bytes); /* {{{ Extract the prompt from the shell output */ for (i=0; i