[Rpm-maint] [PATCH] Fix rpmlog printing of off_t in fdConsume.
Mark Wielaard
mark at klomp.org
Thu Oct 5 21:00:49 UTC 2017
off_t is a somewhat weird type because the only thing that is defined
about it is that it is signed. Depending on whether you are compiling
on a 32 or 64 system and/or whether compiling for large file support
it has different sizes. Currently compiling build/pack.c on 32bit arches
will give a warning because the size doesn't match the %ld format
specifier. Change it to %jd and explicitly cast it to intmax_t to make
it print consistently on any arch.
Signed-off-by: Mark Wielaard <mark at klomp.org>
---
build/pack.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/build/pack.c b/build/pack.c
index 46816cf..1348b5f 100644
--- a/build/pack.c
+++ b/build/pack.c
@@ -431,8 +431,8 @@ static rpmRC fdConsume(FD_t fd, off_t start, off_t nbytes)
};
if (left) {
- rpmlog(RPMLOG_ERR, _("Failed to read %ld bytes in file %s: %s\n"),
- nbytes, Fdescr(fd), Fstrerror(fd));
+ rpmlog(RPMLOG_ERR, _("Failed to read %jd bytes in file %s: %s\n"),
+ (intmax_t) nbytes, Fdescr(fd), Fstrerror(fd));
}
return (left == 0) ? RPMRC_OK : RPMRC_FAIL;
--
1.8.3.1
More information about the Rpm-maint
mailing list