From 0eb784108f8156b21532f312b82f257745c8288a Mon Sep 17 00:00:00 2001 From: tjr Date: Sun, 6 Oct 2002 03:20:27 +0000 Subject: Fix format string errors relating mainly to the use of %qu to print off_t's. Instead use %ju and cast the argument. WFORMAT=0 is still required in the Makefile because gcc warns about some strftime() calls (I don't think this behaviour is useful.) Tested on: sparc64, alpha, i386 --- bin/pax/Makefile | 1 - bin/pax/ar_io.c | 15 ++++++++++----- bin/pax/cpio.c | 5 +++-- bin/pax/gen_subs.c | 3 ++- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/bin/pax/Makefile b/bin/pax/Makefile index 58b4179..270fc1f 100644 --- a/bin/pax/Makefile +++ b/bin/pax/Makefile @@ -29,7 +29,6 @@ PROG= pax SRCS= ar_io.c ar_subs.c buf_subs.c cache.c cpio.c file_subs.c ftree.c \ gen_subs.c getoldopt.c options.c pat_rep.c pax.c sel_subs.c \ tables.c tar.c tty_subs.c -WARNS= 0 WFORMAT=0 #XXX NOTYET #MAN= pax.1 tar.1 cpio.1 diff --git a/bin/pax/ar_io.c b/bin/pax/ar_io.c index 83bb68d..68762b5 100644 --- a/bin/pax/ar_io.c +++ b/bin/pax/ar_io.c @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -384,25 +385,29 @@ ar_close(void) if (frmt == NULL) { # ifdef NET2_STAT (void)fprintf(listf, "%s: unknown format, %lu bytes skipped.\n", + argv0, rdcnt); # else - (void)fprintf(listf, "%s: unknown format, %qu bytes skipped.\n", + (void)fprintf(listf, "%s: unknown format, %ju bytes skipped.\n", + argv0, (uintmax_t)rdcnt); # endif - argv0, rdcnt); (void)fflush(listf); flcnt = 0; return; } if (strcmp(NM_CPIO, argv0) == 0) - (void)fprintf(listf, "%qu blocks\n", (rdcnt ? rdcnt : wrcnt) / 5120); + (void)fprintf(listf, "%llu blocks\n", + (unsigned long long)((rdcnt ? rdcnt : wrcnt) / 5120)); else if (strcmp(NM_TAR, argv0) != 0) (void)fprintf(listf, # ifdef NET2_STAT "%s: %s vol %d, %lu files, %lu bytes read, %lu bytes written.\n", + argv0, frmt->name, arvol-1, flcnt, rdcnt, wrcnt); # else - "%s: %s vol %d, %lu files, %qu bytes read, %qu bytes written.\n", + "%s: %s vol %d, %ju files, %ju bytes read, %ju bytes written.\n", + argv0, frmt->name, arvol-1, (uintmax_t)flcnt, + (uintmax_t)rdcnt, (uintmax_t)wrcnt); # endif - argv0, frmt->name, arvol-1, flcnt, rdcnt, wrcnt); (void)fflush(listf); flcnt = 0; } diff --git a/bin/pax/cpio.c b/bin/pax/cpio.c index ed403db..779e5f9 100644 --- a/bin/pax/cpio.c +++ b/bin/pax/cpio.c @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -223,8 +224,8 @@ rd_ln_nm(ARCHD *arcn) 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); + paxwarn(1, "Cpio link name length is invalid: %ju", + (uintmax_t)arcn->sb.st_size); # endif return(-1); } diff --git a/bin/pax/gen_subs.c b/bin/pax/gen_subs.c index 86e729f..9a91824 100644 --- a/bin/pax/gen_subs.c +++ b/bin/pax/gen_subs.c @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -138,7 +139,7 @@ ls_list(ARCHD *arcn, time_t now, FILE *fp) # ifdef NET2_STAT (void)fprintf(fp, "%9lu ", sbp->st_size); # else - (void)fprintf(fp, "%9qu ", sbp->st_size); + (void)fprintf(fp, "%9ju ", (uintmax_t)sbp->st_size); # endif } -- cgit v1.1