diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/util/common_logging.c | 72 | ||||
-rw-r--r-- | src/util/test_crypto_rsa.c | 4 |
2 files changed, 57 insertions, 19 deletions
diff --git a/src/util/common_logging.c b/src/util/common_logging.c index a391d0b9e..5989db00c 100644 --- a/src/util/common_logging.c +++ b/src/util/common_logging.c | |||
@@ -294,6 +294,7 @@ GNUNET_abort_ () | |||
294 | } | 294 | } |
295 | 295 | ||
296 | 296 | ||
297 | #if ! TALER_WALLET_ONLY | ||
297 | /** | 298 | /** |
298 | * Rotate logs, deleting the oldest log. | 299 | * Rotate logs, deleting the oldest log. |
299 | * | 300 | * |
@@ -407,6 +408,7 @@ setup_log_file (const struct tm *tm) | |||
407 | GNUNET_stderr = altlog; | 408 | GNUNET_stderr = altlog; |
408 | return GNUNET_OK; | 409 | return GNUNET_OK; |
409 | } | 410 | } |
411 | #endif | ||
410 | 412 | ||
411 | 413 | ||
412 | /** | 414 | /** |
@@ -691,8 +693,6 @@ GNUNET_log_setup (const char *comp, | |||
691 | const char *logfile) | 693 | const char *logfile) |
692 | { | 694 | { |
693 | const char *env_logfile; | 695 | const char *env_logfile; |
694 | const struct tm *tm; | ||
695 | time_t t; | ||
696 | 696 | ||
697 | min_level = get_type (loglevel); | 697 | min_level = get_type (loglevel); |
698 | #if !defined(GNUNET_CULL_LOGGING) | 698 | #if !defined(GNUNET_CULL_LOGGING) |
@@ -715,9 +715,20 @@ GNUNET_log_setup (const char *comp, | |||
715 | log_file_name = GNUNET_STRINGS_filename_expand (logfile); | 715 | log_file_name = GNUNET_STRINGS_filename_expand (logfile); |
716 | if (NULL == log_file_name) | 716 | if (NULL == log_file_name) |
717 | return GNUNET_SYSERR; | 717 | return GNUNET_SYSERR; |
718 | t = time (NULL); | 718 | #if TALER_WALLET_ONLY |
719 | tm = gmtime (&t); | 719 | /* log file option not allowed for wallet logic */ |
720 | return setup_log_file (tm); | 720 | GNUNET_assert (NULL == logfile); |
721 | return GNUNET_OK; | ||
722 | #else | ||
723 | { | ||
724 | time_t t; | ||
725 | const struct tm *tm; | ||
726 | |||
727 | t = time (NULL); | ||
728 | tm = gmtime (&t); | ||
729 | return setup_log_file (tm); | ||
730 | } | ||
731 | #endif | ||
721 | } | 732 | } |
722 | 733 | ||
723 | 734 | ||
@@ -806,7 +817,7 @@ output_message (enum GNUNET_ErrorType kind, | |||
806 | * for end users while still having the power of the | 817 | * for end users while still having the power of the |
807 | * logging engine for developer needs. So ideally this | 818 | * logging engine for developer needs. So ideally this |
808 | * is what it should look like when CLI tools are used | 819 | * is what it should look like when CLI tools are used |
809 | * interactively, yet the same message shouldn't look | 820 | * interactively, yet the same message shouldn't look |
810 | * this way if the output is going to logfiles or robots | 821 | * this way if the output is going to logfiles or robots |
811 | * instead. Is this the right place to do this? --lynX | 822 | * instead. Is this the right place to do this? --lynX |
812 | */ | 823 | */ |
@@ -848,7 +859,8 @@ flush_bulk (const char *datestr) | |||
848 | char *last; | 859 | char *last; |
849 | const char *ft; | 860 | const char *ft; |
850 | 861 | ||
851 | if ((0 == last_bulk_time.abs_value_us) || (0 == last_bulk_repeat)) | 862 | if ( (0 == last_bulk_time.abs_value_us) || |
863 | (0 == last_bulk_repeat) ) | ||
852 | return; | 864 | return; |
853 | rev = 0; | 865 | rev = 0; |
854 | last = memchr (last_bulk, '\0', BULK_TRACK_SIZE); | 866 | last = memchr (last_bulk, '\0', BULK_TRACK_SIZE); |
@@ -933,10 +945,15 @@ mylog (enum GNUNET_ErrorType kind, | |||
933 | va_list vacp; | 945 | va_list vacp; |
934 | 946 | ||
935 | va_copy (vacp, va); | 947 | va_copy (vacp, va); |
936 | size = VSNPRINTF (NULL, 0, message, vacp) + 1; | 948 | size = VSNPRINTF (NULL, |
949 | 0, | ||
950 | message, | ||
951 | vacp) + 1; | ||
937 | GNUNET_assert (0 != size); | 952 | GNUNET_assert (0 != size); |
938 | va_end (vacp); | 953 | va_end (vacp); |
939 | memset (date, 0, DATE_STR_SIZE); | 954 | memset (date, |
955 | 0, | ||
956 | DATE_STR_SIZE); | ||
940 | { | 957 | { |
941 | char buf[size]; | 958 | char buf[size]; |
942 | long long offset; | 959 | long long offset; |
@@ -956,8 +973,13 @@ mylog (enum GNUNET_ErrorType kind, | |||
956 | } | 973 | } |
957 | else | 974 | else |
958 | { | 975 | { |
959 | strftime (date2, DATE_STR_SIZE, "%b %d %H:%M:%S-%%020llu", tmptr); | 976 | strftime (date2, |
960 | snprintf (date, sizeof (date), date2, | 977 | DATE_STR_SIZE, |
978 | "%b %d %H:%M:%S-%%020llu", | ||
979 | tmptr); | ||
980 | snprintf (date, | ||
981 | sizeof (date), | ||
982 | date2, | ||
961 | (long long) (pc.QuadPart / | 983 | (long long) (pc.QuadPart / |
962 | (performance_frequency.QuadPart / 1000))); | 984 | (performance_frequency.QuadPart / 1000))); |
963 | } | 985 | } |
@@ -992,17 +1014,26 @@ mylog (enum GNUNET_ErrorType kind, | |||
992 | tmptr = localtime (&timeofday.tv_sec); | 1014 | tmptr = localtime (&timeofday.tv_sec); |
993 | if (NULL == tmptr) | 1015 | if (NULL == tmptr) |
994 | { | 1016 | { |
995 | strcpy (date, "localtime error"); | 1017 | strcpy (date, |
1018 | "localtime error"); | ||
996 | } | 1019 | } |
997 | else | 1020 | else |
998 | { | 1021 | { |
999 | strftime (date2, DATE_STR_SIZE, "%b %d %H:%M:%S-%%06u", tmptr); | 1022 | strftime (date2, |
1000 | snprintf (date, sizeof (date), date2, timeofday.tv_usec); | 1023 | DATE_STR_SIZE, |
1024 | "%b %d %H:%M:%S-%%06u", | ||
1025 | tmptr); | ||
1026 | snprintf (date, | ||
1027 | sizeof (date), | ||
1028 | date2, | ||
1029 | timeofday.tv_usec); | ||
1001 | } | 1030 | } |
1002 | #endif | 1031 | #endif |
1003 | VSNPRINTF (buf, size, message, va); | 1032 | VSNPRINTF (buf, size, message, va); |
1033 | #if ! TALER_WALLET_ONLY | ||
1004 | if (NULL != tmptr) | 1034 | if (NULL != tmptr) |
1005 | (void) setup_log_file (tmptr); | 1035 | (void) setup_log_file (tmptr); |
1036 | #endif | ||
1006 | if ((0 != (kind & GNUNET_ERROR_TYPE_BULK)) && | 1037 | if ((0 != (kind & GNUNET_ERROR_TYPE_BULK)) && |
1007 | (0 != last_bulk_time.abs_value_us) && | 1038 | (0 != last_bulk_time.abs_value_us) && |
1008 | (0 == strncmp (buf, last_bulk, sizeof (last_bulk)))) | 1039 | (0 == strncmp (buf, last_bulk, sizeof (last_bulk)))) |
@@ -1015,12 +1046,19 @@ mylog (enum GNUNET_ErrorType kind, | |||
1015 | return; | 1046 | return; |
1016 | } | 1047 | } |
1017 | flush_bulk (date); | 1048 | flush_bulk (date); |
1018 | strncpy (last_bulk, buf, sizeof (last_bulk)); | 1049 | strncpy (last_bulk, |
1050 | buf, | ||
1051 | sizeof (last_bulk)); | ||
1019 | last_bulk_repeat = 0; | 1052 | last_bulk_repeat = 0; |
1020 | last_bulk_kind = kind; | 1053 | last_bulk_kind = kind; |
1021 | last_bulk_time = GNUNET_TIME_absolute_get (); | 1054 | last_bulk_time = GNUNET_TIME_absolute_get (); |
1022 | strncpy (last_bulk_comp, comp, COMP_TRACK_SIZE); | 1055 | strncpy (last_bulk_comp, |
1023 | output_message (kind, comp, date, buf); | 1056 | comp, |
1057 | COMP_TRACK_SIZE); | ||
1058 | output_message (kind, | ||
1059 | comp, | ||
1060 | date, | ||
1061 | buf); | ||
1024 | } | 1062 | } |
1025 | } | 1063 | } |
1026 | 1064 | ||
diff --git a/src/util/test_crypto_rsa.c b/src/util/test_crypto_rsa.c index 489dc2cf1..c64c0acf9 100644 --- a/src/util/test_crypto_rsa.c +++ b/src/util/test_crypto_rsa.c | |||
@@ -11,7 +11,7 @@ | |||
11 | A PARTICULAR PURPOSE. See the GNU General Public License for more details. | 11 | A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU General Public License along with | 13 | You should have received a copy of the GNU General Public License along with |
14 | TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> | 14 | GNUnet; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> |
15 | */ | 15 | */ |
16 | 16 | ||
17 | /** | 17 | /** |
@@ -112,7 +112,7 @@ main (int argc, | |||
112 | pub); | 112 | pub); |
113 | GNUNET_CRYPTO_rsa_signature_free (bsig); | 113 | GNUNET_CRYPTO_rsa_signature_free (bsig); |
114 | GNUNET_assert (GNUNET_OK == | 114 | GNUNET_assert (GNUNET_OK == |
115 | GNUNET_CRYPTO_rsa_verify (&hash, sig, pub)); | 115 | GNUNET_CRYPTO_rsa_verify (&hash, sig, pub)); |
116 | GNUNET_CRYPTO_rsa_signature_free (sig); | 116 | GNUNET_CRYPTO_rsa_signature_free (sig); |
117 | GNUNET_CRYPTO_rsa_signature_free (sig_copy); | 117 | GNUNET_CRYPTO_rsa_signature_free (sig_copy); |
118 | GNUNET_CRYPTO_rsa_private_key_free (priv); | 118 | GNUNET_CRYPTO_rsa_private_key_free (priv); |