Author: iratqq
Date: Sun Jan 27 10:33:15 2008
New Revision: 5140
Modified:
trunk/emacs/uim-el-helper-agent.c
Log:
* emacs/uim-el-helper-agent.c (read_command):
Insert empty line to buffer for error recovery.
Modified: trunk/emacs/uim-el-helper-agent.c
==============================================================================
--- trunk/emacs/uim-el-helper-agent.c (original)
+++ trunk/emacs/uim-el-helper-agent.c Sun Jan 27 10:33:15 2008
@@ -206,9 +206,13 @@
debug_printf(DEBUG_NOTE, "read command\n");
do {
- if ((len = read(STDIN_FILENO, rbuf, sizeof(rbuf) - 1)) == -1 || len
== 0)
- return; /* XXX */
- rbuf[len] = '\0';
+ if ((len = read(STDIN_FILENO, rbuf, sizeof(rbuf) - 1)) == -1 || len
== 0) {
+ rbuf[0] = '\n';
+ rbuf[1] = '\0';
+ len = 1;
+ debug_printf(DEBUG_NOTE, "stdin has corrupted\n");
+ } else
+ rbuf[len] = '\0';
if (strlen(cmdbuf) + len + 1 > cmdbuf_len) {
cmdbuf_len += DEFAULT_MESSAGE_SIZE;