tevent:signal: fix -O3 error unused result of write
authorMichael Adam <obnox@samba.org>
Wed, 23 Mar 2016 00:41:29 +0000 (01:41 +0100)
committerMichael Adam <obnox@samba.org>
Thu, 12 May 2016 22:16:15 +0000 (00:16 +0200)
some compilers don't tolerate void-casting for warn_unused_result

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Christian Ambach <ambi@samba.org>
lib/tevent/tevent_signal.c

index 9bc11edca42f5d3760a3035a507da73a70f3a780..8a0caae8136d4d7d77665c3af6ae1de44c195bdb 100644 (file)
@@ -106,9 +106,13 @@ static void tevent_common_signal_handler(int signum)
        /* Write to each unique event context. */
        for (sl = sig_state->sig_handlers[signum]; sl; sl = sl->next) {
                if (sl->se->event_ctx && sl->se->event_ctx != ev) {
+                       ssize_t ret;
+
                        ev = sl->se->event_ctx;
                        /* doesn't matter if this pipe overflows */
-                       (void) write(ev->pipe_fds[1], &c, 1);
+                       do {
+                               ret = write(ev->pipe_fds[1], &c, 1);
+                       } while (ret == -1 && errno == EINTR);
                }
        }