[commit: ghc] master: rtx/posix/Itimer.c: Handle return value of `read` (8626d76)

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


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/8626d76a723c2514bab91afb82e6b8b94fed2a2b/ghc

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

commit 8626d76a723c2514bab91afb82e6b8b94fed2a2b
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


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

8626d76a723c2514bab91afb82e6b8b94fed2a2b
 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