static gboolean input_watch_cb(GIOChannel *channel, GIOCondition condition, gpointer data)
{
+ GIOStatus status;
gchar buf[MAX_STRING_LEN];
gsize read;
- GError *error = NULL;
- g_io_channel_read_chars(channel, buf, MAX_STRING_LEN, &read, &error);
+ status = g_io_channel_read_chars(channel, buf, sizeof(buf), &read, NULL);
+ if (status != G_IO_STATUS_NORMAL) {
+ g_printerr("failed to g_io_channel_read_chars(), status[%d]", status);
+ return TRUE;
+ }
+
buf[read] = '\0';
g_strstrip(buf);
interpret(buf);