rtx/posix/Itimer.c: Handle return value of `read`
authorErik de Castro Lopo <erikd@mega-nerd.com>
Fri, 11 Mar 2016 09:40:50 +0000 (10:40 +0100)
committerBen Gamari <ben@smart-cactus.org>
Fri, 11 Mar 2016 12:20:19 +0000 (13:20 +0100)
On Ubuntu libc's `read` function is marked with attribute
`warn_unused_result` which was causing build failures on
Harbourmaster.

Test Plan: validate on Harbourmaster

Reviewers: austin, hvr, bgamari

Reviewed By: hvr, bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1993

GHC Trac Issues: #11697

rts/posix/Itimer.c

index f6c00a6..b833295 100644 (file)
@@ -202,7 +202,8 @@ static void *itimer_thread_func(void *_handle_tick)
 
     while (1) {
         if (USE_TIMERFD_FOR_ITIMER) {
-            read(timerfd, &nticks, sizeof(nticks));
+            if (read(timerfd, &nticks, sizeof(nticks)) != sizeof(nticks))
+                sysErrorBelch("Itimer: read(timer_fd) failed");
         } else {
             usleep(TimeToUS(itimer_interval));
         }