From cd532bb7b866e104304e2443cc942799c385daa5 Mon Sep 17 00:00:00 2001 From: "Neal H. Walfield" Date: Fri, 2 Dec 2016 11:06:25 +0100 Subject: [PATCH] g10: Improve debugging output. * g10/tofu.c (string_to_long): Improve debugging output. (string_to_ulong): Likewise. Signed-off-by: Neal H. Walfield --- g10/tofu.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/g10/tofu.c b/g10/tofu.c index c307d2575..18f9c5486 100644 --- a/g10/tofu.c +++ b/g10/tofu.c @@ -410,9 +410,12 @@ string_to_long (long *r_value, const char *string, long fallback, int line) if (errno || !(!strcmp (tail, ".0") || !*tail)) { err = errno? gpg_error_from_errno (errno) : gpg_error (GPG_ERR_BAD_DATA); - log_debug ("%s:%d: " - "strtol failed for DB returned string (tail=%.10s): %s\n", - __FILE__, line, tail, gpg_strerror (err)); + log_debug ("%s:%d: strtol failed for TOFU DB data; returned string" + " (string='%.10s%s'; tail='%.10s%s'): %s\n", + __FILE__, line, + string, string && strlen(string) > 10 ? "..." : "", + tail, tail && strlen(tail) > 10 ? "..." : "", + gpg_strerror (err)); *r_value = fallback; } else @@ -438,9 +441,12 @@ string_to_ulong (unsigned long *r_value, const char *string, if (errno || !(!strcmp (tail, ".0") || !*tail)) { err = errno? gpg_error_from_errno (errno) : gpg_error (GPG_ERR_BAD_DATA); - log_debug ("%s:%d: " - "strtoul failed for DB returned string (tail=%.10s): %s\n", - __FILE__, line, tail, gpg_strerror (err)); + log_debug ("%s:%d: strtoul failed for TOFU DB data; returned string" + " (string='%.10s%s'; tail='%.10s%s'): %s\n", + __FILE__, line, + string, string && strlen(string) > 10 ? "..." : "", + tail, tail && strlen(tail) > 10 ? "..." : "", + gpg_strerror (err)); *r_value = fallback; } else