[project @ 1997-07-25 21:14:49 by sof]
authorsof <unknown>
Fri, 25 Jul 1997 21:14:49 +0000 (21:14 +0000)
committersof <unknown>
Fri, 25 Jul 1997 21:14:49 +0000 (21:14 +0000)
Fool proofed syscalls in pagefaults()

ghc/runtime/storage/SMstats.lc

index 9e98bb7..74d5d92 100644 (file)
@@ -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");