Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEyal Birger <eyal.birger@gmail.com>2016-06-20 08:36:47 +0300
committerFelix Fietkau <nbd@nbd.name>2016-06-26 14:05:54 +0300
commitd197c8ffa3cc61a747f318fd0ecef1f6e39b3935 (patch)
treeb4eeab6cb0ba52b13c7b31fa4e813bdefb6ec373 /uloop.c
parent1ad3d93eb888ae7db3dd97e43e611979352b1aac (diff)
uloop: handle waker pipe write() return value
Recent glibc warns if result of read() or write() is unused. Added a retry in case of EINTR, all other faults are silently discarded. Signed-off-by: Eyal Birger <eyal.birger@gmail.com> ----- - I was not able to reproduce the EINTR case, but it seems to be the right thing to do - Retrying on EAGAIN in this case would be weird as there is no one to read from the other end of the pipe. We could call waker_consume() directly but since the size of the message is just one byte, I think this would be dead code
Diffstat (limited to 'uloop.c')
-rw-r--r--uloop.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/uloop.c b/uloop.c
index 0b75d4b..1c5bcee 100644
--- a/uloop.c
+++ b/uloop.c
@@ -387,7 +387,13 @@ static void uloop_handle_processes(void)
static void uloop_signal_wake(void)
{
- write(waker_pipe, "w", 1);
+ do {
+ if (write(waker_pipe, "w", 1) < 0) {
+ if (errno == EINTR)
+ continue;
+ }
+ break;
+ } while (1);
}
static void uloop_handle_sigint(int signo)