From: sof Date: Fri, 25 Jul 1997 21:14:49 +0000 (+0000) Subject: [project @ 1997-07-25 21:14:49 by sof] X-Git-Tag: Approximately_1000_patches_recorded~239 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=8a3fbd420d87fd01506ae31e44e480eddb12aea7;p=ghc-hetmet.git [project @ 1997-07-25 21:14:49 by sof] Fool proofed syscalls in pagefaults() --- diff --git a/ghc/runtime/storage/SMstats.lc b/ghc/runtime/storage/SMstats.lc index 9e98bb7..74d5d92 100644 --- a/ghc/runtime/storage/SMstats.lc +++ b/ghc/runtime/storage/SMstats.lc @@ -238,21 +238,21 @@ pagefaults(STG_NO_ARGS) sprintf(proc,"/proc/%d", getpid()); /* ToDo: this string is static per process, optimise? */ - while ((fd = open(proc, O_RDONLY)) != 0) { + while ((fd = open(proc, O_RDONLY)) == -1 ) { if ( errno != EINTR ) { fflush(stdout); fprintf(stderr,"pagefaults: open() failed\n"); EXIT(EXIT_FAILURE); } } - while (ioctl(fd, PIOCUSAGE, &prusage) != 0 ) { + while (ioctl(fd, PIOCUSAGE, &prusage) == -1 ) { if (errno != EINTR) { fflush(stdout); fprintf(stderr,"pagefaults: ioctl() failed\n"); EXIT(EXIT_FAILURE); } } - while ((close(fd)) != 0) { + while ((close(fd)) == -1 ) { if (errno != EINTR) { fflush(stdout); fprintf(stderr, "pagefaults: close() failed\n");