From: Greg Hudson Date: Fri, 3 Apr 2020 05:04:06 +0000 (-0400) Subject: Correct formatting of trace log microseconds X-Git-Tag: krb5-1.19-beta1~92 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1059%2Fhead;p=thirdparty%2Fkrb5.git Correct formatting of trace log microseconds Always use six digits with leading 0s to format the microseconds in trace log timestamps; otherwise a small value appears as too large of a fraction of a second. ticket: 8894 (new) tags: pullup target_version: 1.18-next target_version: 1.17-next --- diff --git a/src/lib/krb5/os/trace.c b/src/lib/krb5/os/trace.c index 2a03ae9806..7073459f0f 100644 --- a/src/lib/krb5/os/trace.c +++ b/src/lib/krb5/os/trace.c @@ -411,8 +411,8 @@ krb5int_trace(krb5_context context, const char *fmt, ...) goto cleanup; if (krb5_crypto_us_timeofday(&sec, &usec) != 0) goto cleanup; - if (asprintf(&msg, "[%d] %u.%d: %s\n", (int) getpid(), (unsigned int) sec, - (int) usec, str) < 0) + if (asprintf(&msg, "[%d] %u.%06d: %s\n", (int)getpid(), + (unsigned int)sec, (int)usec, str) < 0) goto cleanup; info.message = msg; context->trace_callback(context, &info, context->trace_callback_data);