qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qemu: reset buffer pointers after CR/LF
@ 2007-08-13 16:27 Jim Paris
  0 siblings, 0 replies; only message in thread
From: Jim Paris @ 2007-08-13 16:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: jim

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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-08-13 16:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-13 16:27 [Qemu-devel] [PATCH] qemu: reset buffer pointers after CR/LF Jim Paris

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).