diff options
author | Luiz Augusto von Dentz <luiz.dentz-von@nokia.com> | 2011-01-19 13:55:08 +0200 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.dentz-von@nokia.com> | 2011-01-19 14:10:05 +0200 |
commit | 90e78131e3e347eeee25e5cd831b374907359e3f (patch) | |
tree | 7a736208c38d8380a2a8d7ae3313e2b3128f80cd | |
parent | 92b3bfda58f454fe7e48d03fad8086e4318f3733 (diff) | |
download | bluez-90e78131e3e347eeee25e5cd831b374907359e3f.tar.gz |
Fix use of deprecated glib on hciops plugin
-rw-r--r-- | plugins/hciops.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/plugins/hciops.c b/plugins/hciops.c index fec7e166c..1efbbd2a0 100644 --- a/plugins/hciops.c +++ b/plugins/hciops.c @@ -1868,18 +1868,21 @@ static gboolean io_security_event(GIOChannel *chan, GIOCondition cond, int type, index = GPOINTER_TO_INT(data); struct dev_info *dev = &devs[index]; struct hci_dev_info di; - size_t len; + ssize_t len; hci_event_hdr *eh; - GIOError err; evt_cmd_status *evt; + int fd; if (cond & (G_IO_NVAL | G_IO_HUP | G_IO_ERR)) { stop_hci_dev(index); return FALSE; } - if ((err = g_io_channel_read(chan, (gchar *) buf, sizeof(buf), &len))) { - if (err == G_IO_ERROR_AGAIN) + fd = g_io_channel_unix_get_fd(chan); + + len = read(fd, buf, sizeof(buf)); + if (len < 0) { + if (errno == EAGAIN) return TRUE; stop_hci_dev(index); return FALSE; @@ -2345,15 +2348,16 @@ static gboolean io_stack_event(GIOChannel *chan, GIOCondition cond, evt_stack_internal *si; evt_si_device *sd; hci_event_hdr *eh; - int type; - size_t len; - GIOError err; + int type, fd; + ssize_t len; ptr = buf; - err = g_io_channel_read(chan, (gchar *) buf, sizeof(buf), &len); - if (err) { - if (err == G_IO_ERROR_AGAIN) + fd = g_io_channel_unix_get_fd(chan); + + len = read(fd, buf, sizeof(buf)); + if (len < 0) { + if (errno == EAGAIN) return TRUE; error("Read from control socket failed: %s (%d)", |