git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] archive-tar.c: squelch a type mismatch warning

From
Junio C Hamano <gitster@pobox.com>
Date
May 7, 2009, 08:08 UTC
Message-ID
<7vd4alfi8c.fsf@alter.siamese.dyndns.org>

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

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 * 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(-)
diff --git a/archive-tar.c b/archive-tar.c
index ba890eb..cee06ce 100644
--- a/archive-tar.c
+++ b/archive-tar.c
@@ -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);
Message 1 of 1 in “archive-tar.c: squelch a type mismatch warning”
  1. archive-tar.c: squelch a type mismatch warningJunio C Hamano, May 7, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.