1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-11 09:50:12 +00:00

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
This commit is contained in:
Tim J. Robbins 2002-10-06 03:20:27 +00:00
parent c32049aa33
commit 5b94264c20
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=104548
4 changed files with 17 additions and 11 deletions

View File

@ -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

View File

@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@ -384,25 +385,29 @@ ar_close(void)
if (frmt == NULL) {
# ifdef NET2_STAT
(void)fprintf(listf, "%s: unknown format, %lu bytes skipped.\n",
# else
(void)fprintf(listf, "%s: unknown format, %qu bytes skipped.\n",
# endif
argv0, rdcnt);
# else
(void)fprintf(listf, "%s: unknown format, %ju bytes skipped.\n",
argv0, (uintmax_t)rdcnt);
# endif
(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",
# else
"%s: %s vol %d, %lu files, %qu bytes read, %qu bytes written.\n",
# endif
argv0, frmt->name, arvol-1, flcnt, rdcnt, wrcnt);
# else
"%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
(void)fflush(listf);
flcnt = 0;
}

View File

@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
#include <sys/time.h>
#include <sys/stat.h>
#include <string.h>
#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
@ -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);
}

View File

@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
#include <sys/time.h>
#include <sys/stat.h>
#include <langinfo.h>
#include <stdint.h>
#include <stdio.h>
#include <utmp.h>
#include <unistd.h>
@ -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
}