abrt/0005-more-glib2.31-fixes.patch
2011-12-07 16:38:32 +01:00

49 lines
1.7 KiB
Diff

From 2e941ae3c1d13968bda8bb4594a5aa566aa2e5dd Mon Sep 17 00:00:00 2001
From: Jiri Moskovcak <jmoskovc@redhat.com>
Date: Wed, 7 Dec 2011 16:12:28 +0100
Subject: [PATCH 5/5] more glib2.31 fixes
---
src/daemon/abrtd.c | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/daemon/abrtd.c b/src/daemon/abrtd.c
index d3a759a..3d71e80 100644
--- a/src/daemon/abrtd.c
+++ b/src/daemon/abrtd.c
@@ -238,7 +238,7 @@ static gboolean handle_signal_cb(GIOChannel *gio, GIOCondition condition, gpoint
{
uint8_t signo;
gsize len = 0;
- g_io_channel_read(gio, (void*) &signo, 1, &len);
+ g_io_channel_read_chars(gio, (void*) &signo, 1, &len, NULL);
if (len == 1)
{
/* we did receive a signal */
@@ -382,10 +382,19 @@ static gboolean handle_inotify_cb(GIOChannel *gio, GIOCondition condition, gpoin
char *buf = (char*)xmalloc(inotify_bytes);
errno = 0;
gsize len;
- GIOError err = g_io_channel_read(gio, buf, inotify_bytes, &len);
- if (err != G_IO_ERROR_NONE)
+ GError *gerror = NULL;
+ g_io_channel_set_encoding(gio, NULL, &gerror);
+ /* need to set the encoding otherwise we get:
+ * Invalid byte sequence in conversion input
+ * according to manual "NULL" is safe for binary data
+ */
+ if (gerror)
+ perror_msg("Can't set encoding on gio channel: '%s'", gerror->message);
+
+ GIOStatus err = g_io_channel_read_chars(gio, buf, inotify_bytes, &len, &gerror);
+ if (err != G_IO_STATUS_NORMAL)
{
- perror_msg("Error reading inotify fd");
+ perror_msg("Error reading inotify fd: %s", gerror ? gerror->message : "unknown");
free(buf);
return FALSE; /* "remove this event" (huh??) */
}
--
1.7.7.3