diff options
-rw-r--r-- | src/config.c | 16 | ||||
-rw-r--r-- | src/rtnl.c | 15 |
2 files changed, 19 insertions, 12 deletions
diff --git a/src/config.c b/src/config.c index 9dd09115..e4dfcd90 100644 --- a/src/config.c +++ b/src/config.c @@ -421,20 +421,22 @@ static gboolean inotify_data(GIOChannel *channel, GIOCondition cond, char buffer[256]; char *next_event; gsize bytes_read; - GIOError err; + GIOStatus status; if (cond & (G_IO_NVAL | G_IO_ERR | G_IO_HUP)) { inotify_watch = 0; return FALSE; } - err = g_io_channel_read(channel, buffer, - sizeof(buffer) - 1, &bytes_read); - - if (err != G_IO_ERROR_NONE) { - if (err == G_IO_ERROR_AGAIN) - return TRUE; + status = g_io_channel_read_chars(channel, buffer, + sizeof(buffer) -1, &bytes_read, NULL); + switch (status) { + case G_IO_STATUS_NORMAL: + break; + case G_IO_STATUS_AGAIN: + return TRUE; + default: connman_error("Reading from inotify channel failed"); inotify_watch = 0; return FALSE; @@ -1331,17 +1331,22 @@ static gboolean netlink_event(GIOChannel *chan, { unsigned char buf[4096]; gsize len; - GIOError err; + GIOStatus status; if (cond & (G_IO_NVAL | G_IO_HUP | G_IO_ERR)) return FALSE; memset(buf, 0, sizeof(buf)); - err = g_io_channel_read(chan, (gchar *) buf, sizeof(buf), &len); - if (err) { - if (err == G_IO_ERROR_AGAIN) - return TRUE; + status = g_io_channel_read_chars(chan, (gchar *) buf, + sizeof(buf), &len, NULL); + + switch (status) { + case G_IO_STATUS_NORMAL: + break; + case G_IO_STATUS_AGAIN: + return TRUE; + default: return FALSE; } |