[commit: ghc] ghc-8.0: rtx/posix/Itimer.c: Handle return value of `read` (fd3e581)

git at git.haskell.org git at git.haskell.org
Fri Mar 11 14:21:27 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/fd3e581b7c9142247601774afc98e49f63b8af45/ghc

>---------------------------------------------------------------

commit fd3e581b7c9142247601774afc98e49f63b8af45
Author: Erik de Castro Lopo <erikd at mega-nerd.com>
Date:   Fri Mar 11 10:40:50 2016 +0100

    rtx/posix/Itimer.c: Handle return value of `read`
    
    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
    
    (cherry picked from commit 8626d76a723c2514bab91afb82e6b8b94fed2a2b)


>---------------------------------------------------------------

fd3e581b7c9142247601774afc98e49f63b8af45
 rts/posix/Itimer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/rts/posix/Itimer.c b/rts/posix/Itimer.c
index f6c00a6..b833295 100644
--- a/rts/posix/Itimer.c
+++ b/rts/posix/Itimer.c
@@ -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));
         }



More information about the ghc-commits mailing list