[Pkg-gnupg-commit] [gnupg2] 26/132: agent: Use "ll" length specifier when time_t is larger.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed May 17 03:07:39 UTC 2017


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch experimental
in repository gnupg2.

commit 170660ed11b56145dea4865e751ae5aff1681fe2
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Mon Apr 10 15:04:57 2017 +0900

    agent: Use "ll" length specifier when time_t is larger.
    
    * agent/command.c (cmd_keytocard): Use KEYTOCARD_TIMESTAMP_FORMAT.
    
    --
    
    On a big-endian 32-bit platform which uses 64-bit time_t, it might go
    wrong.
    
    Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
---
 agent/command.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/agent/command.c b/agent/command.c
index 1f8f7c2..ab6d7eb 100644
--- a/agent/command.c
+++ b/agent/command.c
@@ -2477,6 +2477,12 @@ cmd_delete_key (assuan_context_t ctx, char *line)
 
 
 

+#if SIZEOF_TIME_T > SIZEOF_UNSIGNED_LONG
+#define KEYTOCARD_TIMESTAMP_FORMAT "(10:created-at10:%010llu))"
+#else
+#define KEYTOCARD_TIMESTAMP_FORMAT "(10:created-at10:%010lu))"
+#endif
+
 static const char hlp_keytocard[] =
   "KEYTOCARD [--force] <hexstring_with_keygrip> <serialno> <id> <timestamp>\n"
   "\n";
@@ -2580,7 +2586,7 @@ cmd_keytocard (assuan_context_t ctx, char *line)
   gcry_sexp_release (s_skey);
   keydatalen--;			/* Decrement for last '\0'.  */
   /* Add timestamp "created-at" in the private key */
-  snprintf (keydata+keydatalen-1, 30, "(10:created-at10:%010lu))", timestamp);
+  snprintf (keydata+keydatalen-1, 30, KEYTOCARD_TIMESTAMP_FORMAT, timestamp);
   keydatalen += 10 + 19 - 1;
   err = divert_writekey (ctrl, force, serialno, id, keydata, keydatalen);
   xfree (keydata);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list