summaryrefslogtreecommitdiffstats
path: root/alsa-binding
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2019-08-14 17:58:29 +0200
committerJonathan Aillet <jonathan.aillet@iot.bzh>2019-08-14 17:58:29 +0200
commita9e19b4ce2888312e43007d28928da45cf91f507 (patch)
tree0f052a12485fa9521e97a9534693fd64b5321da9 /alsa-binding
parent33e6fa922e81bcf7341c0476c20f095b9e778e12 (diff)
Avoid epoll errors to be fired indefinitely
When a audio card with control event generation is removed, avoid epoll errors to be fired indefinitely by event loop. Bug-AGL: SPEC-2749 Change-Id: I65dddc2f9714fa2303773b212bc3cad7cb164d73 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to 'alsa-binding')
-rw-r--r--alsa-binding/Alsa-RegEvt.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/alsa-binding/Alsa-RegEvt.c b/alsa-binding/Alsa-RegEvt.c
index 974431e..36bb590 100644
--- a/alsa-binding/Alsa-RegEvt.c
+++ b/alsa-binding/Alsa-RegEvt.c
@@ -101,6 +101,12 @@ STATIC int sndCtlEventCB(sd_event_source* src, int fd, uint32_t revents, void* u
ctlRequestT ctlRequest;
snd_ctl_elem_id_t *elemId;
+ if ((revents & EPOLLERR) != 0) {
+ AFB_ERROR("An error has been send by event loop polling, prevent new errors to be fired by deleting event src");
+ sd_event_source_unref(src);
+ return -1;
+ }
+
if ((revents & EPOLLHUP) != 0) {
AFB_NOTICE("SndCtl hanghup [car disconnected]");
goto ExitOnSucess;