Forgot to inject "\r\n" in the timeout handler

This commit is contained in:
Pierre Pronchery 2010-05-08 14:29:46 +00:00
parent 317954ec36
commit 1e735470f5

View File

@ -1353,12 +1353,12 @@ static gboolean _on_timeout(gpointer data)
return FALSE; return FALSE;
if((cmd = gsm_command_get_command(gsmc)) == NULL) if((cmd = gsm_command_get_command(gsmc)) == NULL)
return FALSE; return FALSE;
len = strlen(cmd); len = strlen(cmd) + 2;
/* re-inject the command */ /* re-inject the command */
if((p = realloc(gsm->wr_buf, len)) == NULL) if((p = realloc(gsm->wr_buf, len + 1)) == NULL)
return FALSE; return FALSE;
gsm->wr_buf = p; gsm->wr_buf = p;
memcpy(p, cmd, len); snprintf(p, len + 1, "%s%s", cmd, "\r\n");
gsm->wr_buf_cnt = len; gsm->wr_buf_cnt = len;
gsm->wr_source = g_io_add_watch(gsm->channel, G_IO_OUT, gsm->wr_source = g_io_add_watch(gsm->channel, G_IO_OUT,
_on_watch_can_write, gsm); _on_watch_can_write, gsm);