Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/cp for display in the (post) SIGINFO handler use off_t n...
details: https://anonhg.NetBSD.org/src/rev/c64bbe6c8864
branches: trunk
changeset: 343865:c64bbe6c8864
user: mrg <mrg%NetBSD.org@localhost>
date: Mon Feb 29 04:22:21 2016 +0000
description:
for display in the (post) SIGINFO handler use off_t not size_t for
file sizes. fixes incorrect reporting errors on 32 bit platforms
with >4GB file sizes.
diffstat:
bin/cp/utils.c | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 deletions(-)
diffs (59 lines):
diff -r 460f7c4655a8 -r c64bbe6c8864 bin/cp/utils.c
--- a/bin/cp/utils.c Mon Feb 29 02:19:37 2016 +0000
+++ b/bin/cp/utils.c Mon Feb 29 04:22:21 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: utils.c,v 1.44 2015/03/03 00:20:38 enami Exp $ */
+/* $NetBSD: utils.c,v 1.45 2016/02/29 04:22:21 mrg Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)utils.c 8.3 (Berkeley) 4/1/94";
#else
-__RCSID("$NetBSD: utils.c,v 1.44 2015/03/03 00:20:38 enami Exp $");
+__RCSID("$NetBSD: utils.c,v 1.45 2016/02/29 04:22:21 mrg Exp $");
#endif
#endif /* not lint */
@@ -77,17 +77,18 @@
struct finfo {
const char *from;
const char *to;
- size_t size;
+ off_t size;
};
static void
-progress(const struct finfo *fi, size_t written)
+progress(const struct finfo *fi, off_t written)
{
int pcent = (int)((100.0 * written) / fi->size);
pinfo = 0;
- (void)fprintf(stderr, "%s => %s %zu/%zu bytes %d%% written\n",
- fi->from, fi->to, written, fi->size, pcent);
+ (void)fprintf(stderr, "%s => %s %llu/%llu bytes %d%% written\n",
+ fi->from, fi->to, (unsigned long long)written,
+ (unsigned long long)fi->size, pcent);
}
int
@@ -97,7 +98,7 @@
struct stat to_stat, *fs;
int ch, checkch, from_fd, rcount, rval, to_fd, tolnk, wcount;
char *p;
- size_t ptotal = 0;
+ off_t ptotal = 0;
if ((from_fd = open(entp->fts_path, O_RDONLY, 0)) == -1) {
warn("%s", entp->fts_path);
@@ -184,7 +185,7 @@
fi.from = entp->fts_path;
fi.to = to.p_path;
- fi.size = (size_t)fs->st_size;
+ fi.size = fs->st_size;
/*
* Mmap and write if less than 8M (the limit is so
Home |
Main Index |
Thread Index |
Old Index