From e26794ace9b12a87f67b20a151d2c71a1563e26a Mon Sep 17 00:00:00 2001 From: teor Date: Tue, 31 Jul 2018 11:20:44 +1000 Subject: [PATCH 1/2] Add TOR_PRIdSZ to torint.h --- src/lib/cc/torint.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lib/cc/torint.h b/src/lib/cc/torint.h index b97fc8d975..5097724726 100644 --- a/src/lib/cc/torint.h +++ b/src/lib/cc/torint.h @@ -100,6 +100,16 @@ typedef int32_t ssize_t; # define TOR_PRIuSZ "zu" #endif +#ifdef _WIN32 +# ifdef _WIN64 +# define TOR_PRIdSZ PRId64 +# else +# define TOR_PRIdSZ PRId32 +# endif +#else +# define TOR_PRIdSZ "zd" +#endif + #ifndef SSIZE_MAX #if (SIZEOF_SIZE_T == 4) #define SSIZE_MAX INT32_MAX From 9118430b14dc20e0e2816d2dafe76714861b43b5 Mon Sep 17 00:00:00 2001 From: teor Date: Tue, 31 Jul 2018 11:19:41 +1000 Subject: [PATCH 2/2] Use Windows-compatible format strings in tor-print-ed-signing-cert.c Fixes bug 26986; bugfix on master. --- changes/bug26986 | 3 +++ src/tools/tor-print-ed-signing-cert.c | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 changes/bug26986 diff --git a/changes/bug26986 b/changes/bug26986 new file mode 100644 index 0000000000..a3ab9ff25d --- /dev/null +++ b/changes/bug26986 @@ -0,0 +1,3 @@ + o Minor bugfixes (compilation): + - Use Windows-compatible format strings in tor-print-ed-signing-cert.c. + Fixes bug 26986; bugfix on master. diff --git a/src/tools/tor-print-ed-signing-cert.c b/src/tools/tor-print-ed-signing-cert.c index ca53e34d5d..0f64059d84 100644 --- a/src/tools/tor-print-ed-signing-cert.c +++ b/src/tools/tor-print-ed-signing-cert.c @@ -7,6 +7,7 @@ #include #include "ed25519_cert.h" +#include "lib/cc/torint.h" /* TOR_PRIdSZ */ #include "lib/crypt_ops/crypto_format.h" #include "lib/malloc/malloc.h" @@ -49,8 +50,8 @@ main(int argc, char **argv) ssize_t parsed = ed25519_cert_parse(&cert, certbuf, cert_body_len); if (parsed <= 0) { - fprintf(stderr, "ed25519_cert_parse failed with return value %zd\n", - parsed); + fprintf(stderr, "ed25519_cert_parse failed with return value %" TOR_PRIdSZ + "\n", parsed); return -5; }