diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-02-25 00:46:09 +0100 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2022-02-25 08:48:59 +0100 |
commit | 5e4cbb92beb575ad5b072334b42d66feb0f0c331 (patch) | |
tree | a1f7e1ae5f77e09e94329ba1cbe6ebb3fc0ba690 /src/util/common_logging.c | |
parent | 86e73d58ffc79ea706a5bc83867de3def4eaba48 (diff) | |
download | gnunet-5e4cbb92beb575ad5b072334b42d66feb0f0c331.tar.gz gnunet-5e4cbb92beb575ad5b072334b42d66feb0f0c331.zip |
add GNUNET_B2S() macro; fix dht_line_test: we sign over query_hash, not block key
Diffstat (limited to 'src/util/common_logging.c')
-rw-r--r-- | src/util/common_logging.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/util/common_logging.c b/src/util/common_logging.c index cba37cd2f..b07f3fc0b 100644 --- a/src/util/common_logging.c +++ b/src/util/common_logging.c | |||
@@ -321,6 +321,28 @@ log_rotate (const char *new_name) | |||
321 | } | 321 | } |
322 | 322 | ||
323 | 323 | ||
324 | const char * | ||
325 | GNUNET_b2s (const void *buf, | ||
326 | size_t buf_size) | ||
327 | { | ||
328 | static GNUNET_THREAD_LOCAL char ret[9]; | ||
329 | struct GNUNET_HashCode hc; | ||
330 | char *tmp; | ||
331 | |||
332 | GNUNET_CRYPTO_hash (buf, | ||
333 | buf_size, | ||
334 | &hc); | ||
335 | tmp = GNUNET_STRINGS_data_to_string_alloc (&hc, | ||
336 | sizeof (hc)); | ||
337 | memcpy (ret, | ||
338 | tmp, | ||
339 | 8); | ||
340 | GNUNET_free (tmp); | ||
341 | ret[8] = '\0'; | ||
342 | return ret; | ||
343 | } | ||
344 | |||
345 | |||
324 | /** | 346 | /** |
325 | * Setup the log file. | 347 | * Setup the log file. |
326 | * | 348 | * |
@@ -1015,7 +1037,8 @@ mylog (enum GNUNET_ErrorType kind, | |||
1015 | else | 1037 | else |
1016 | { | 1038 | { |
1017 | /* RFC 3339 timestamp, with snprintf placeholder for microseconds */ | 1039 | /* RFC 3339 timestamp, with snprintf placeholder for microseconds */ |
1018 | if (0 == strftime (date2, DATE_STR_SIZE, "%Y-%m-%dT%H:%M:%S.%%06u%z", tmptr)) | 1040 | if (0 == strftime (date2, DATE_STR_SIZE, "%Y-%m-%dT%H:%M:%S.%%06u%z", |
1041 | tmptr)) | ||
1019 | abort (); | 1042 | abort (); |
1020 | /* Fill in microseconds */ | 1043 | /* Fill in microseconds */ |
1021 | if (0 > snprintf (date, sizeof(date), date2, timeofday.tv_usec)) | 1044 | if (0 > snprintf (date, sizeof(date), date2, timeofday.tv_usec)) |