* [PATCH v3] emulator/hciemu: Fix not handling failed read correctly
@ 2014-09-25 14:32 Szymon Janc
2014-09-29 8:27 ` Szymon Janc
0 siblings, 1 reply; 2+ messages in thread
From: Szymon Janc @ 2014-09-25 14:32 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v3] emulator/hciemu: Fix not handling failed read correctly
2014-09-25 14:32 [PATCH v3] emulator/hciemu: Fix not handling failed read correctly Szymon Janc
@ 2014-09-29 8:27 ` Szymon Janc
0 siblings, 0 replies; 2+ messages in thread
From: Szymon Janc @ 2014-09-29 8:27 UTC (permalink / raw)
To: linux-bluetooth
On Thursday 25 of September 2014 16:32:38 Szymon Janc wrote:
> 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;
>
>
Applied.
--
Best regards,
Szymon Janc
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-09-29 8:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-25 14:32 [PATCH v3] emulator/hciemu: Fix not handling failed read correctly Szymon Janc
2014-09-29 8:27 ` Szymon Janc
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.