summaryrefslogtreecommitdiff
path: root/emulator/hciemu.c
diff options
context:
space:
mode:
authorSzymon Janc <szymon.janc@tieto.com>2014-09-25 12:33:53 +0200
committerSzymon Janc <szymon.janc@tieto.com>2014-09-29 10:02:28 +0200
commitcc91d165c566e1e296bcb50c4430b9b1c6a1129a (patch)
tree4a673cc0868a64dd35a7a60358751525e754842b /emulator/hciemu.c
parent7a964f0bfa0c11cf8a838e89879f0b4ffb00b531 (diff)
downloadbluez-cc91d165c566e1e296bcb50c4430b9b1c6a1129a.tar.gz
emulator/hciemu: Fix not handling failed read correctly
If read failed due to signal or blocking watch was removed resulting in closing /dev/vhci and emulated adapter being removed. This was affecting android-tester since premature removal of adapter is considered error on android daemon.
Diffstat (limited to 'emulator/hciemu.c')
-rw-r--r--emulator/hciemu.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/emulator/hciemu.c b/emulator/hciemu.c
index 50285e4f5..fcaeb7092 100644
--- a/emulator/hciemu.c
+++ b/emulator/hciemu.c
@@ -179,6 +179,13 @@ static gboolean receive_btdev(GIOChannel *channel, GIOCondition condition,
fd = g_io_channel_unix_get_fd(channel);
len = read(fd, buf, sizeof(buf));
+ if (len < 0) {
+ if (errno == EAGAIN || errno == EINTR)
+ return TRUE;
+
+ return FALSE;
+ }
+
if (len < 1)
return FALSE;