diff options
author | Werner Koch <[email protected]> | 2007-04-20 16:59:37 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2007-04-20 16:59:37 +0000 |
commit | b89d98e3353f6101bc256476c0269f48a92d3f56 (patch) | |
tree | 6da6c9dd9e7b78f97ae6e89e54e6603f314cc644 /scd | |
parent | * certcheck.c (do_encode_md): Add arg PKEY. Add support for DSA2 (diff) | |
download | gnupg-b89d98e3353f6101bc256476c0269f48a92d3f56.tar.gz gnupg-b89d98e3353f6101bc256476c0269f48a92d3f56.zip |
Improved logging for error orginating from libgcrypt.
Diffstat (limited to 'scd')
-rw-r--r-- | scd/ChangeLog | 7 | ||||
-rw-r--r-- | scd/sc-copykeys.c | 23 | ||||
-rw-r--r-- | scd/scdaemon.c | 24 |
3 files changed, 11 insertions, 43 deletions
diff --git a/scd/ChangeLog b/scd/ChangeLog index 769ef0a14..c0141c74a 100644 --- a/scd/ChangeLog +++ b/scd/ChangeLog @@ -1,3 +1,10 @@ +2007-04-20 Werner Koch <[email protected]> + + * sc-copykeys.c (my_gcry_logger): Removed. + (main): Call setup_libgcrypt_logging helper. + * scdaemon.c (my_gcry_logger): Removed. + (main): Call setup_libgcrypt_logging helper. + 2007-04-03 Werner Koch <[email protected]> * command.c (cmd_getinfo): New subcommand "reader_list". diff --git a/scd/sc-copykeys.c b/scd/sc-copykeys.c index acb3e2d2a..b18311f44 100644 --- a/scd/sc-copykeys.c +++ b/scd/sc-copykeys.c @@ -93,25 +93,6 @@ my_strusage (int level) return p; } -/* Used by gcry for logging */ -static void -my_gcry_logger (void *dummy, int level, const char *fmt, va_list arg_ptr) -{ - /* translate the log levels */ - switch (level) - { - case GCRY_LOG_CONT: level = JNLIB_LOG_CONT; break; - case GCRY_LOG_INFO: level = JNLIB_LOG_INFO; break; - case GCRY_LOG_WARN: level = JNLIB_LOG_WARN; break; - case GCRY_LOG_ERROR:level = JNLIB_LOG_ERROR; break; - case GCRY_LOG_FATAL:level = JNLIB_LOG_FATAL; break; - case GCRY_LOG_BUG: level = JNLIB_LOG_BUG; break; - case GCRY_LOG_DEBUG:level = JNLIB_LOG_DEBUG; break; - default: level = JNLIB_LOG_ERROR; break; - } - log_logv (level, fmt, arg_ptr); -} - int main (int argc, char **argv ) @@ -131,11 +112,11 @@ main (int argc, char **argv ) the option parsing may need services of the library */ if (!gcry_check_version (NEED_LIBGCRYPT_VERSION) ) { - log_fatal( _("libgcrypt is too old (need %s, have %s)\n"), + log_fatal (_("%s is too old (need %s, have %s)\n"), "libgcrypt", NEED_LIBGCRYPT_VERSION, gcry_check_version (NULL) ); } - gcry_set_log_handler (my_gcry_logger, NULL); + setup_libgcrypt_logging (); gcry_control (GCRYCTL_DISABLE_SECMEM, 0); /* FIXME - we want to use it */ /* FIXME? gcry_control (GCRYCTL_USE_SECURE_RNDPOOL);*/ diff --git a/scd/scdaemon.c b/scd/scdaemon.c index 19c656202..b87c0f3e5 100644 --- a/scd/scdaemon.c +++ b/scd/scdaemon.c @@ -221,25 +221,6 @@ i18n_init (void) -/* Used by gcry for logging */ -static void -my_gcry_logger (void *dummy, int level, const char *fmt, va_list arg_ptr) -{ - /* translate the log levels */ - switch (level) - { - case GCRY_LOG_CONT: level = JNLIB_LOG_CONT; break; - case GCRY_LOG_INFO: level = JNLIB_LOG_INFO; break; - case GCRY_LOG_WARN: level = JNLIB_LOG_WARN; break; - case GCRY_LOG_ERROR:level = JNLIB_LOG_ERROR; break; - case GCRY_LOG_FATAL:level = JNLIB_LOG_FATAL; break; - case GCRY_LOG_BUG: level = JNLIB_LOG_BUG; break; - case GCRY_LOG_DEBUG:level = JNLIB_LOG_DEBUG; break; - default: level = JNLIB_LOG_ERROR; break; - } - log_logv (level, fmt, arg_ptr); -} - /* Setup the debugging. With a LEVEL of NULL only the active debug flags are propagated to the subsystems. With LEVEL set, a specific @@ -355,7 +336,7 @@ main (int argc, char **argv ) the option parsing may need services of the library */ if (!gcry_check_version (NEED_LIBGCRYPT_VERSION) ) { - log_fatal( _("libgcrypt is too old (need %s, have %s)\n"), + log_fatal (_("%s is too old (need %s, have %s)\n"), "libgcrypt", NEED_LIBGCRYPT_VERSION, gcry_check_version (NULL) ); } @@ -366,8 +347,7 @@ main (int argc, char **argv ) assuan_set_assuan_log_prefix (log_get_prefix (NULL)); assuan_set_assuan_err_source (GPG_ERR_SOURCE_DEFAULT); - - gcry_set_log_handler (my_gcry_logger, NULL); + setup_libgcrypt_logging (); gcry_control (GCRYCTL_USE_SECURE_RNDPOOL); may_coredump = disable_core_dumps (); |