Eliminate poisonous LONG_OFF_T conditional
authorguenther <guenther@openbsd.org>
Wed, 8 Jan 2014 04:58:36 +0000 (04:58 +0000)
committerguenther <guenther@openbsd.org>
Wed, 8 Jan 2014 04:58:36 +0000 (04:58 +0000)
adjective suggested by deraadt@

bin/pax/Makefile
bin/pax/ar_io.c
bin/pax/cpio.c
bin/pax/gen_subs.c
bin/pax/options.c
bin/pax/tar.c

index 9ea2e86..0db098b 100644 (file)
@@ -1,15 +1,4 @@
-#      $OpenBSD: Makefile,v 1.10 2001/05/26 00:32:20 millert Exp $
-
-# To install on versions prior to BSD 4.4 the following may have to be
-# defined with CFLAGS +=
-#
-# -DLONG_OFF_T Define this if the base type of an off_t is a long (and is
-#              NOT a quad).  (This is often defined in the file
-#              /usr/include/sys/types.h).
-#              This define is important, as if you do have a quad_t
-#              off_t and define LONG_OFF_T, pax will compile but will
-#              NOT RUN PROPERLY.
-#
+#      $OpenBSD: Makefile,v 1.11 2014/01/08 04:58:36 guenther Exp $
 
 PROG=   pax
 SRCS=  ar_io.c ar_subs.c buf_subs.c cache.c cpio.c file_subs.c ftree.c\
index ac9b5b4..b8aa571 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ar_io.c,v 1.41 2014/01/08 04:42:24 guenther Exp $     */
+/*     $OpenBSD: ar_io.c,v 1.42 2014/01/08 04:58:36 guenther Exp $     */
 /*     $NetBSD: ar_io.c,v 1.5 1996/03/26 23:54:13 mrg Exp $    */
 
 /*-
@@ -379,11 +379,7 @@ ar_close(void)
         * could have written anything yet.
         */
        if (frmt == NULL) {
-#      ifdef LONG_OFF_T
-               (void)fprintf(listf, "%s: unknown format, %lu bytes skipped.\n",
-#      else
                (void)fprintf(listf, "%s: unknown format, %qu bytes skipped.\n",
-#      endif
                    argv0, rdcnt);
                (void)fflush(listf);
                flcnt = 0;
@@ -394,11 +390,7 @@ ar_close(void)
                (void)fprintf(listf, "%qu blocks\n", (rdcnt ? rdcnt : wrcnt) / 5120);
        else if (strcmp(NM_TAR, argv0) != 0)
                (void)fprintf(listf,
-#      ifdef LONG_OFF_T
-                   "%s: %s vol %d, %lu files, %lu bytes read, %lu bytes written.\n",
-#      else
                    "%s: %s vol %d, %lu files, %qu bytes read, %qu bytes written.\n",
-#      endif
                    argv0, frmt->name, arvol-1, flcnt, rdcnt, wrcnt);
        (void)fflush(listf);
        flcnt = 0;
index 33358ec..bdc0900 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: cpio.c,v 1.22 2013/07/03 04:08:29 guenther Exp $      */
+/*     $OpenBSD: cpio.c,v 1.23 2014/01/08 04:58:36 guenther Exp $      */
 /*     $NetBSD: cpio.c,v 1.5 1995/03/21 09:07:13 cgd Exp $     */
 
 /*-
@@ -211,13 +211,8 @@ rd_ln_nm(ARCHD *arcn)
         */
        if ((arcn->sb.st_size == 0) ||
            (arcn->sb.st_size >= sizeof(arcn->ln_name))) {
-#              ifdef LONG_OFF_T
-               paxwarn(1, "Cpio link name length is invalid: %lu",
-                   arcn->sb.st_size);
-#              else
                paxwarn(1, "Cpio link name length is invalid: %qu",
                    arcn->sb.st_size);
-#              endif
                return(-1);
        }
 
@@ -304,13 +299,8 @@ cpio_rd(ARCHD *arcn, char *buf)
        else
                arcn->sb.st_mtime = val;
        arcn->sb.st_ctime = arcn->sb.st_atime = arcn->sb.st_mtime;
-#      ifdef LONG_OFF_T
-       arcn->sb.st_size = (off_t)asc_ul(hd->c_filesize,sizeof(hd->c_filesize),
-           OCT);
-#      else
        arcn->sb.st_size = (off_t)asc_uqd(hd->c_filesize,sizeof(hd->c_filesize),
            OCT);
-#      endif
 
        /*
         * check name size and if valid, read in the name of this entry (name
@@ -405,13 +395,8 @@ cpio_wr(ARCHD *arcn)
                /*
                 * set data size for file data
                 */
-#              ifdef LONG_OFF_T
-               if (ul_asc((u_long)arcn->sb.st_size, hd->c_filesize,
-                   sizeof(hd->c_filesize), OCT)) {
-#              else
                if (uqd_asc((u_quad_t)arcn->sb.st_size, hd->c_filesize,
                    sizeof(hd->c_filesize), OCT)) {
-#              endif
                        paxwarn(1,"File is too large for cpio format %s",
                            arcn->org_name);
                        return(1);
@@ -589,13 +574,8 @@ vcpio_rd(ARCHD *arcn, char *buf)
        arcn->sb.st_gid = (gid_t)asc_ul(hd->c_gid, sizeof(hd->c_gid), HEX);
        arcn->sb.st_mtime = (time_t)asc_ul(hd->c_mtime,sizeof(hd->c_mtime),HEX);
        arcn->sb.st_ctime = arcn->sb.st_atime = arcn->sb.st_mtime;
-#      ifdef LONG_OFF_T
-       arcn->sb.st_size = (off_t)asc_ul(hd->c_filesize,
-           sizeof(hd->c_filesize), HEX);
-#      else
        arcn->sb.st_size = (off_t)asc_uqd(hd->c_filesize,
            sizeof(hd->c_filesize), HEX);
-#      endif
        arcn->sb.st_nlink = (nlink_t)asc_ul(hd->c_nlink, sizeof(hd->c_nlink),
            HEX);
        devmajor = (dev_t)asc_ul(hd->c_maj, sizeof(hd->c_maj), HEX);
@@ -730,13 +710,8 @@ vcpio_wr(ARCHD *arcn)
                 * much to pad.
                 */
                arcn->pad = VCPIO_PAD(arcn->sb.st_size);
-#              ifdef LONG_OFF_T
-               if (ul_asc((u_long)arcn->sb.st_size, hd->c_filesize,
-                   sizeof(hd->c_filesize), HEX)) {
-#              else
                if (uqd_asc((u_quad_t)arcn->sb.st_size, hd->c_filesize,
                    sizeof(hd->c_filesize), HEX)) {
-#              endif
                        paxwarn(1,"File is too large for sv4cpio format %s",
                            arcn->org_name);
                        return(1);
index 5739099..d8aeebc 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: gen_subs.c,v 1.22 2013/07/03 04:08:29 guenther Exp $  */
+/*     $OpenBSD: gen_subs.c,v 1.23 2014/01/08 04:58:36 guenther Exp $  */
 /*     $NetBSD: gen_subs.c,v 1.5 1995/03/21 09:07:26 cgd Exp $ */
 
 /*-
@@ -121,18 +121,10 @@ ls_list(ARCHD *arcn, time_t now, FILE *fp)
         * print device id's for devices, or sizes for other nodes
         */
        if ((arcn->type == PAX_CHR) || (arcn->type == PAX_BLK))
-#              ifdef LONG_OFF_T
-               (void)fprintf(fp, "%4u,%4u ", MAJOR(sbp->st_rdev),
-#              else
                (void)fprintf(fp, "%4lu,%4lu ", (unsigned long)MAJOR(sbp->st_rdev),
-#              endif
                    (unsigned long)MINOR(sbp->st_rdev));
        else {
-#              ifdef LONG_OFF_T
-               (void)fprintf(fp, "%9lu ", sbp->st_size);
-#              else
                (void)fprintf(fp, "%9qu ", sbp->st_size);
-#              endif
        }
 
        /*
index dcd1cf8..b613011 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: options.c,v 1.77 2013/03/27 17:14:10 zhuk Exp $       */
+/*     $OpenBSD: options.c,v 1.78 2014/01/08 04:58:36 guenther Exp $   */
 /*     $NetBSD: options.c,v 1.6 1996/03/26 23:54:18 mrg Exp $  */
 
 /*-
@@ -1457,13 +1457,8 @@ str_offt(char *val)
        char *expr;
        off_t num, t;
 
-#      ifdef LONG_OFF_T
-       num = strtol(val, &expr, 0);
-       if ((num == LONG_MAX) || (num <= 0) || (expr == val))
-#      else
        num = strtoq(val, &expr, 0);
        if ((num == QUAD_MAX) || (num <= 0) || (expr == val))
-#      endif
                return(0);
 
        switch (*expr) {
index 49c050a..d476e5e 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: tar.c,v 1.50 2014/01/08 04:41:41 guenther Exp $       */
+/*     $OpenBSD: tar.c,v 1.51 2014/01/08 04:58:36 guenther Exp $       */
 /*     $NetBSD: tar.c,v 1.5 1995/03/21 09:07:49 cgd Exp $      */
 
 /*-
@@ -404,11 +404,7 @@ tar_rd(ARCHD *arcn, char *buf)
            0xfff);
        arcn->sb.st_uid = (uid_t)asc_ul(hd->uid, sizeof(hd->uid), OCT);
        arcn->sb.st_gid = (gid_t)asc_ul(hd->gid, sizeof(hd->gid), OCT);
-#ifdef LONG_OFF_T
-       arcn->sb.st_size = (off_t)asc_ul(hd->size, sizeof(hd->size), OCT);
-#else
        arcn->sb.st_size = (off_t)asc_uqd(hd->size, sizeof(hd->size), OCT);
-#endif
        val = asc_uqd(hd->mtime, sizeof(hd->mtime), OCT);
        if ((time_t)val < 0 || (time_t)val != val)
                arcn->sb.st_mtime = INT_MAX;                    /* XXX 2038 */
@@ -619,13 +615,8 @@ tar_wr(ARCHD *arcn)
                 * data follows this file, so set the pad
                 */
                hd->linkflag = AREGTYPE;
-#              ifdef LONG_OFF_T
-               if (ul_oct((u_long)arcn->sb.st_size, hd->size,
-                   sizeof(hd->size), 1)) {
-#              else
                if (uqd_oct((u_quad_t)arcn->sb.st_size, hd->size,
                    sizeof(hd->size), 1)) {
-#              endif
                        paxwarn(1,"File is too large for tar %s", arcn->org_name);
                        return(1);
                }
@@ -805,11 +796,7 @@ ustar_rd(ARCHD *arcn, char *buf)
         */
        arcn->sb.st_mode = (mode_t)(asc_ul(hd->mode, sizeof(hd->mode), OCT) &
            0xfff);
-#ifdef LONG_OFF_T
-       arcn->sb.st_size = (off_t)asc_ul(hd->size, sizeof(hd->size), OCT);
-#else
        arcn->sb.st_size = (off_t)asc_uqd(hd->size, sizeof(hd->size), OCT);
-#endif
        val = asc_uqd(hd->mtime, sizeof(hd->mtime), OCT);
        if ((time_t)val < 0 || (time_t)val != val)
                arcn->sb.st_mtime = INT_MAX;                    /* XXX 2038 */
@@ -1045,13 +1032,8 @@ ustar_wr(ARCHD *arcn)
                else
                        hd->typeflag = REGTYPE;
                arcn->pad = TAR_PAD(arcn->sb.st_size);
-#              ifdef LONG_OFF_T
-               if (ul_oct((u_long)arcn->sb.st_size, hd->size,
-                   sizeof(hd->size), 3)) {
-#              else
                if (uqd_oct((u_quad_t)arcn->sb.st_size, hd->size,
                    sizeof(hd->size), 3)) {
-#              endif
                        paxwarn(1,"File is too long for ustar %s",arcn->org_name);
                        return(1);
                }