Skip to contentSkip to conversation

qemu: reset buffer pointers after CR/LF

PATCH New Jim Paris 1 participant 1 message Aug 13, 2007

lore
Share & tools
lore

Jim Paris

author
#0 lore raw

PATCH 1/1 qemu: reset buffer pointers after CR/LF

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.

---

Index: readline.c
===================================================================
RCS file: /sources/qemu/qemu/readline.c,v
retrieving revision 1.2

readline.c +4 -0
diff -u -r1.2 readline.c
@@ -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;