From: Szymon Janc <szymon.janc@tieto.com>
To: linux-bluetooth@vger.kernel.org
Cc: Szymon Janc <szymon.janc@tieto.com>
Subject: [PATCH v3] emulator/hciemu: Fix not handling failed read correctly
Date: Thu, 25 Sep 2014 16:32:38 +0200 [thread overview]
Message-ID: <1411655558-18167-1-git-send-email-szymon.janc@tieto.com> (raw)
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.
---
emulator/hciemu.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/emulator/hciemu.c b/emulator/hciemu.c
index 50285e4..fcaeb70 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;
--
1.9.1
next reply other threads:[~2014-09-25 14:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-25 14:32 Szymon Janc [this message]
2014-09-29 8:27 ` [PATCH v3] emulator/hciemu: Fix not handling failed read correctly Szymon Janc
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1411655558-18167-1-git-send-email-szymon.janc@tieto.com \
--to=szymon.janc@tieto.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox