diff options
author | Chris Michael <cp.michael@samsung.com> | 2013-08-05 11:46:04 +0100 |
---|---|---|
committer | Chris Michael <cp.michael@samsung.com> | 2013-08-05 11:46:04 +0100 |
commit | 76766161d2761d82bac085f2746dcb3f2d9ff056 (patch) | |
tree | 241403a85bd54d564d8592f8bc3babe524230d17 /src/lib/ecore_audio/ecore_audio_pulse_ml.c | |
parent | 4c9c52233704e6788ce3771b4a42f5060b97272c (diff) |
ecore_main_fd_handler_fd_get can return -1 so we need to check for a
valid fd before calling read().
Reuse returned fd variable in the callback to save extra function call
to ecore_main_fd_handler_fd_get (since we already acquired the fd
above).
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Diffstat (limited to '')
-rw-r--r-- | src/lib/ecore_audio/ecore_audio_pulse_ml.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lib/ecore_audio/ecore_audio_pulse_ml.c b/src/lib/ecore_audio/ecore_audio_pulse_ml.c index b9ce552f18..ce41c7e9a6 100644 --- a/src/lib/ecore_audio/ecore_audio_pulse_ml.c +++ b/src/lib/ecore_audio/ecore_audio_pulse_ml.c | |||
@@ -48,10 +48,15 @@ _ecore_io_wrapper(void *data, Ecore_Fd_Handler *handler) | |||
48 | 48 | ||
49 | if (ecore_main_fd_handler_active_get(handler, ECORE_FD_READ)) | 49 | if (ecore_main_fd_handler_active_get(handler, ECORE_FD_READ)) |
50 | { | 50 | { |
51 | int fd; | ||
52 | |||
51 | flags |= PA_IO_EVENT_INPUT; | 53 | flags |= PA_IO_EVENT_INPUT; |
52 | 54 | ||
55 | fd = ecore_main_fd_handler_fd_get(handler); | ||
56 | if (fd < 0) return ECORE_CALLBACK_RENEW; | ||
57 | |||
53 | /* Check for HUP and report */ | 58 | /* Check for HUP and report */ |
54 | if (recv(ecore_main_fd_handler_fd_get(handler), buf, 64, MSG_PEEK)) | 59 | if (recv(fd, buf, 64, MSG_PEEK)) |
55 | { | 60 | { |
56 | if (errno == ESHUTDOWN || errno == ECONNRESET || errno == ECONNABORTED || errno == ENETRESET) | 61 | if (errno == ESHUTDOWN || errno == ECONNRESET || errno == ECONNABORTED || errno == ENETRESET) |
57 | { | 62 | { |
@@ -66,7 +71,7 @@ _ecore_io_wrapper(void *data, Ecore_Fd_Handler *handler) | |||
66 | if (ecore_main_fd_handler_active_get(handler, ECORE_FD_ERROR)) | 71 | if (ecore_main_fd_handler_active_get(handler, ECORE_FD_ERROR)) |
67 | flags |= PA_IO_EVENT_ERROR; | 72 | flags |= PA_IO_EVENT_ERROR; |
68 | 73 | ||
69 | event->callback(event->mainloop, event, ecore_main_fd_handler_fd_get(handler), flags, event->userdata); | 74 | event->callback(event->mainloop, event, fd, flags, event->userdata); |
70 | 75 | ||
71 | return ECORE_CALLBACK_RENEW; | 76 | return ECORE_CALLBACK_RENEW; |
72 | } | 77 | } |