Skip to contentSkip to conversation

archive-tar.c: squelch a type mismatch warning

PATCH New Junio C Hamano 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 archive-tar.c: squelch a type mismatch warning

On some systems, giving a value of type time_t to printf "%lo" that expects an unsigned long would give a type mismatch warning.

---

* A fallout from my foray into FreeBSD (7.2) running on Linux kvm. I was a bit surprised to find that there only was this one, without saying anything to NoThanks.

 archive-tar.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
archive-tar.c +1 -1
index ba890eb..cee06ce 100644
@@ -180,7 +180,7 @@ static int write_tar_entry(struct archiver_args *args,
 
 	sprintf(header.mode, "%07o", mode & 07777);
 	sprintf(header.size, "%011lo", S_ISREG(mode) ? size : 0);
-	sprintf(header.mtime, "%011lo", args->time);
+	sprintf(header.mtime, "%011lo", (unsigned long) args->time);
 
 	sprintf(header.uid, "%07o", 0);
 	sprintf(header.gid, "%07o", 0);