aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2016-07-13 17:44:01 +0200
committerJunio C Hamano <gitster@pobox.com>2016-07-13 09:14:47 -0700
commitfd3e67474c0b349049ccff5f72a50ef930a56013 (patch)
tree6ecfa60c3ca6b8abb880edfc4e1aa1ed5369d004
parent7171a0b0cf5792fd549b601c84b274cd5e4155ed (diff)
downloadgit-fd3e67474c0b349049ccff5f72a50ef930a56013.tar.gz
git-fd3e67474c0b349049ccff5f72a50ef930a56013.tar.xz
index-pack: report correct bad object offsets even if they are large
Use the right type for offsets in this case, off_t, which makes a difference on 32-bit systems with large file support, and change formatting code accordingly. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/index-pack.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index cafaab7b1..e2d8ae4a0 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -338,10 +338,10 @@ static void parse_pack_header(void)
use(sizeof(struct pack_header));
}
-static NORETURN void bad_object(unsigned long offset, const char *format,
+static NORETURN void bad_object(off_t offset, const char *format,
...) __attribute__((format (printf, 2, 3)));
-static NORETURN void bad_object(unsigned long offset, const char *format, ...)
+static NORETURN void bad_object(off_t offset, const char *format, ...)
{
va_list params;
char buf[1024];
@@ -349,7 +349,8 @@ static NORETURN void bad_object(unsigned long offset, const char *format, ...)
va_start(params, format);
vsnprintf(buf, sizeof(buf), format, params);
va_end(params);
- die(_("pack has bad object at offset %lu: %s"), offset, buf);
+ die(_("pack has bad object at offset %"PRIuMAX": %s"),
+ (uintmax_t)offset, buf);
}
static inline struct thread_local *get_thread_data(void)