made a bit more robust
authorceriel <none@none>
Fri, 30 Jun 1989 14:46:27 +0000 (14:46 +0000)
committerceriel <none@none>
Fri, 30 Jun 1989 14:46:27 +0000 (14:46 +0000)
modules/src/system/close.c
modules/src/system/read.c
modules/src/system/seek.c
modules/src/system/write.c

index 350b72a..3cfcf34 100644 (file)
@@ -9,7 +9,9 @@
 sys_close(fp)
        register File *fp;
 {
-       fp->o_flags = 0;
-       close(fp->o_fd);
-       fp->o_fd = -1;
+       if (fp) {
+               fp->o_flags = 0;
+               close(fp->o_fd);
+               fp->o_fd = -1;
+       }
 }
index 1180234..b88d9d0 100644 (file)
@@ -12,5 +12,6 @@ sys_read(fp, bufptr, bufsiz, pnbytes)
        char *bufptr;
        int bufsiz, *pnbytes;
 {
+       if (! fp) return 0;
        return (*pnbytes = read(fp->o_fd, bufptr, bufsiz)) >= 0;
 }
index 2d742fa..132a5fc 100644 (file)
@@ -14,5 +14,6 @@ sys_seek(fp, off, whence, poff)
        long off;
        long *poff;
 {
+       if (! fp) return 0;
        return (*poff = lseek(fp->o_fd, off, whence)) >= 0;
 }
index 582ecd3..dd98446 100644 (file)
@@ -12,5 +12,6 @@ sys_write(fp, bufptr, nbytes)
        char *bufptr;
        int nbytes;
 {
+       if (! fp) return 0;
        return write(fp->o_fd, bufptr, nbytes) == nbytes;
 }