fixes without testing for mmap, lseek, fseek when quads went in
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Mon, 22 Jun 1992 04:41:24 +0000 (20:41 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Mon, 22 Jun 1992 04:41:24 +0000 (20:41 -0800)
SCCS-vsn: usr.bin/tail/forward.c 5.7
SCCS-vsn: usr.bin/tail/reverse.c 5.6
SCCS-vsn: usr.bin/tail/tail.c 5.11

usr/src/usr.bin/tail/forward.c
usr/src/usr.bin/tail/reverse.c
usr/src/usr.bin/tail/tail.c

index 8370ecd..0dabbe1 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)forward.c  5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)forward.c  5.7 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/types.h>
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -174,8 +174,8 @@ rlines(fp, off, sbp)
        if (!(size = sbp->st_size))
                return;
 
        if (!(size = sbp->st_size))
                return;
 
-       if ((start = mmap(NULL,
-           size, PROT_READ, MAP_FILE, fileno(fp), (off_t)0)) == (caddr_t)-1) {
+       if ((start = mmap(NULL, (size_t)size,
+           PROT_READ, MAP_FILE, fileno(fp), (off_t)0)) == (caddr_t)-1) {
                err(0, "%s", strerror(errno));
                return;
        }
                err(0, "%s", strerror(errno));
                return;
        }
@@ -190,7 +190,7 @@ rlines(fp, off, sbp)
        /* Set the file pointer to reflect the length displayed. */
        size = sbp->st_size - size;
        WR(p, size);
        /* Set the file pointer to reflect the length displayed. */
        size = sbp->st_size - size;
        WR(p, size);
-       if (fseek(fp, sbp->st_size, SEEK_SET) == -1) {
+       if (fseek(fp, (long)sbp->st_size, SEEK_SET) == -1) {
                ierr();
                return;
        }
                ierr();
                return;
        }
index cb7ccf8..d1a3bcb 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)reverse.c  5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)reverse.c  5.6 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -88,8 +88,8 @@ r_reg(fp, style, off, sbp)
        if (!(size = sbp->st_size))
                return;
 
        if (!(size = sbp->st_size))
                return;
 
-       if ((p = mmap(NULL,
-           size, PROT_READ, MAP_FILE, fileno(fp), (off_t)0)) == (caddr_t)-1) {
+       if ((p = mmap(NULL, (size_t)size,
+           PROT_READ, MAP_FILE, fileno(fp), (off_t)0)) == (caddr_t)-1) {
                err(0, "%s", strerror(errno));
                return;
        }
                err(0, "%s", strerror(errno));
                return;
        }
index 68ae66b..17fe8f3 100644 (file)
@@ -15,7 +15,7 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)tail.c     5.10 (Berkeley) %G%";
+static char sccsid[] = "@(#)tail.c     5.11 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/types.h>
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -165,7 +165,7 @@ main(argc, argv)
                 * Determine if input is a pipe.  4.4BSD will set the SOCKET
                 * bit in the st_mode field for pipes.  Fix this then.
                 */
                 * Determine if input is a pipe.  4.4BSD will set the SOCKET
                 * bit in the st_mode field for pipes.  Fix this then.
                 */
-               if (lseek(fileno(stdin), 0L, SEEK_CUR) == -1 &&
+               if (lseek(fileno(stdin), (off_t)0, SEEK_CUR) == -1 &&
                    errno == ESPIPE) {
                        errno = 0;
                        fflag = 0;              /* POSIX.2 requires this. */
                    errno == ESPIPE) {
                        errno = 0;
                        fflag = 0;              /* POSIX.2 requires this. */