summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2011-01-18 15:07:15 +0100
committerMarcel Holtmann <marcel@holtmann.org>2011-01-18 15:07:15 +0100
commit39a35f57667d8fce6829dcc7dd34f4e3ad8bb65b (patch)
tree695da59b618e0f9ae3de39bf738eec50eba8d1ed
parent9d3358012a48fa4b617ee78de8b2fcf01ee8d5d5 (diff)
downloadconnman-39a35f57667d8fce6829dcc7dd34f4e3ad8bb65b.tar.gz
connman-39a35f57667d8fce6829dcc7dd34f4e3ad8bb65b.tar.bz2
connman-39a35f57667d8fce6829dcc7dd34f4e3ad8bb65b.zip
Use g_io_channel_read_chars instead of g_io_channel_read
-rw-r--r--src/config.c16
-rw-r--r--src/rtnl.c15
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;
diff --git a/src/rtnl.c b/src/rtnl.c
index 71424fcc..f486a187 100644
--- a/src/rtnl.c
+++ b/src/rtnl.c
@@ -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;
}