]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Correct formatting of trace log microseconds 1059/head
authorGreg Hudson <ghudson@mit.edu>
Fri, 3 Apr 2020 05:04:06 +0000 (01:04 -0400)
committerGreg Hudson <ghudson@mit.edu>
Wed, 8 Apr 2020 19:26:19 +0000 (15:26 -0400)
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

src/lib/krb5/os/trace.c

index 2a03ae98067453f2143cca69004fc0af76dc1395..7073459f0fac31ad96eefe980bc3a98c7ed51ca5 100644 (file)
@@ -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);