diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-01-05 17:27:32 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-01-05 17:27:32 +0100 |
commit | 7de0ac8e4675e875cb40c0a6d3e3df5191e01959 (patch) | |
tree | a06357e237a11ac4b37f954f4b1235249f7a264c /src/util/common_logging.c | |
parent | 1c456639363f1a80c4818b3c99511b9f460e5ed8 (diff) | |
download | gnunet-7de0ac8e4675e875cb40c0a6d3e3df5191e01959.tar.gz gnunet-7de0ac8e4675e875cb40c0a6d3e3df5191e01959.zip |
check strftime return value
Diffstat (limited to 'src/util/common_logging.c')
-rw-r--r-- | src/util/common_logging.c | 54 |
1 files changed, 34 insertions, 20 deletions
diff --git a/src/util/common_logging.c b/src/util/common_logging.c index 3e71fa476..ea5430191 100644 --- a/src/util/common_logging.c +++ b/src/util/common_logging.c | |||
@@ -976,20 +976,25 @@ mylog (enum GNUNET_ErrorType kind, | |||
976 | } | 976 | } |
977 | else | 977 | else |
978 | { | 978 | { |
979 | strftime (date2, | 979 | if (0 == |
980 | DATE_STR_SIZE, | 980 | strftime (date2, |
981 | "%b %d %H:%M:%S-%%020llu", | 981 | DATE_STR_SIZE, |
982 | tmptr); | 982 | "%b %d %H:%M:%S-%%020llu", |
983 | snprintf (date, | 983 | tmptr)) |
984 | sizeof (date), | 984 | abort (); |
985 | date2, | 985 | if (0 > |
986 | (long long) (pc.QuadPart / | 986 | snprintf (date, |
987 | (performance_frequency.QuadPart / 1000))); | 987 | sizeof (date), |
988 | date2, | ||
989 | (long long) (pc.QuadPart / | ||
990 | (performance_frequency.QuadPart / 1000)))) | ||
991 | abort (); | ||
988 | } | 992 | } |
989 | #else | 993 | #else |
990 | struct timeval timeofday; | 994 | struct timeval timeofday; |
991 | 995 | ||
992 | gettimeofday (&timeofday, NULL); | 996 | gettimeofday (&timeofday, |
997 | NULL); | ||
993 | offset = GNUNET_TIME_get_offset (); | 998 | offset = GNUNET_TIME_get_offset (); |
994 | if (offset > 0) | 999 | if (offset > 0) |
995 | { | 1000 | { |
@@ -1022,24 +1027,33 @@ mylog (enum GNUNET_ErrorType kind, | |||
1022 | } | 1027 | } |
1023 | else | 1028 | else |
1024 | { | 1029 | { |
1025 | strftime (date2, | 1030 | if (0 == |
1026 | DATE_STR_SIZE, | 1031 | strftime (date2, |
1027 | "%b %d %H:%M:%S-%%06u", | 1032 | DATE_STR_SIZE, |
1028 | tmptr); | 1033 | "%b %d %H:%M:%S-%%06u", |
1029 | snprintf (date, | 1034 | tmptr)) |
1030 | sizeof (date), | 1035 | abort (); |
1031 | date2, | 1036 | if (0 > |
1032 | timeofday.tv_usec); | 1037 | snprintf (date, |
1038 | sizeof (date), | ||
1039 | date2, | ||
1040 | timeofday.tv_usec)) | ||
1041 | abort (); | ||
1033 | } | 1042 | } |
1034 | #endif | 1043 | #endif |
1035 | VSNPRINTF (buf, size, message, va); | 1044 | VSNPRINTF (buf, |
1045 | size, | ||
1046 | message, | ||
1047 | va); | ||
1036 | #if ! (defined(GNUNET_CULL_LOGGING) || TALER_WALLET_ONLY) | 1048 | #if ! (defined(GNUNET_CULL_LOGGING) || TALER_WALLET_ONLY) |
1037 | if (NULL != tmptr) | 1049 | if (NULL != tmptr) |
1038 | (void) setup_log_file (tmptr); | 1050 | (void) setup_log_file (tmptr); |
1039 | #endif | 1051 | #endif |
1040 | if ((0 != (kind & GNUNET_ERROR_TYPE_BULK)) && | 1052 | if ((0 != (kind & GNUNET_ERROR_TYPE_BULK)) && |
1041 | (0 != last_bulk_time.abs_value_us) && | 1053 | (0 != last_bulk_time.abs_value_us) && |
1042 | (0 == strncmp (buf, last_bulk, sizeof (last_bulk)))) | 1054 | (0 == strncmp (buf, |
1055 | last_bulk, | ||
1056 | sizeof (last_bulk)))) | ||
1043 | { | 1057 | { |
1044 | last_bulk_repeat++; | 1058 | last_bulk_repeat++; |
1045 | if ( (GNUNET_TIME_absolute_get_duration (last_bulk_time).rel_value_us > | 1059 | if ( (GNUNET_TIME_absolute_get_duration (last_bulk_time).rel_value_us > |