qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jim Paris <jim@jtan.com>
To: qemu-devel@nongnu.org
Cc: jim@jtan.com
Subject: [Qemu-devel] [PATCH] qemu: reset buffer pointers after CR/LF
Date: Mon, 13 Aug 2007 12:27:31 -0400	[thread overview]
Message-ID: <20070813162731.GA26350@jim.sh> (raw)

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 pointers when it is processed.

Signed-off-by: Jim Paris <jim@jtan.com>
---

Index: readline.c
===================================================================
RCS file: /sources/qemu/qemu/readline.c,v
retrieving revision 1.2
diff -u -r1.2 readline.c
--- readline.c	25 Jun 2007 11:36:50 -0000	1.2
+++ readline.c	13 Aug 2007 16:23:29 -0000
@@ -374,6 +374,10 @@
             if (!term_is_password)
                 term_hist_add(term_cmd_buf);
             term_printf("\n");
+            term_cmd_buf_index = 0;
+            term_cmd_buf_size = 0;
+            term_last_cmd_buf_index = 0;
+            term_last_cmd_buf_size = 0;
             /* NOTE: readline_start can be called here */
             term_readline_func(term_readline_opaque, term_cmd_buf);
             break;

                 reply	other threads:[~2007-08-13 16:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070813162731.GA26350@jim.sh \
    --to=jim@jtan.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).