From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jim Paris Subject: [PATCH 3/3] qemu: reset buffer pointers after CR/LF Date: Wed, 8 Aug 2007 16:22:49 -0400 Message-ID: <11866045691503-git-send-email-jim@jtan.com> References: 46B9896D.3030506@qumranet.com <1186604569626-git-send-email-jim@jtan.com> <11866045692122-git-send-email-jim@jtan.com> <1186604569652-git-send-email-jim@jtan.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Jim Paris To: Uri Lublin , kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Return-path: In-Reply-To: <1186604569652-git-send-email-jim-XrPbb/hENzg@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org If readline_handle_byte() is sent both a CR and LF, and readline_start() is not called after the first CR, then the LF will cause the same command to be executed a second time. Fix this by explicitly resetting the buffer pointer when it is processed. Signed-off-by: Jim Paris --- This should probably get pushed upstream too. qemu/readline.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/qemu/readline.c b/qemu/readline.c index cbe33db..bde3342 100644 --- a/qemu/readline.c +++ b/qemu/readline.c @@ -335,6 +335,8 @@ void readline_handle_byte(int ch) if (!term_is_password) term_hist_add(term_cmd_buf); term_printf("\n"); + term_cmd_buf_index = 0; + term_cmd_buf_size = 0; /* NOTE: readline_start can be called here */ term_readline_func(term_readline_opaque, term_cmd_buf); break; -- 1.5.3.GIT ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/