1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

Fixed a nasty bug in scdaemon which led to a card reset if the card was

inserted  during scdaemon startup and a connection was made before the
ticker had a chance to run.  Add some stuff for better debugging.
This commit is contained in:
Werner Koch 2009-02-25 10:58:56 +00:00
parent ae63e6da8d
commit 618afc4231
9 changed files with 93 additions and 20 deletions

View file

@ -1,6 +1,6 @@
/* logging.c - Useful logging functions
* Copyright (C) 1998, 1999, 2000, 2001, 2003,
* 2004, 2005, 2006 Free Software Foundation, Inc.
* 2004, 2005, 2006, 2009 Free Software Foundation, Inc.
*
* This file is part of JNLIB.
*
@ -61,6 +61,7 @@ static char prefix_buffer[80];
static int with_time;
static int with_prefix;
static int with_pid;
static unsigned long (*get_tid_callback)(void);
static int running_detached;
static int force_prefixes;
@ -365,6 +366,13 @@ log_set_fd (int fd)
}
void
log_set_get_tid_callback (unsigned long (*cb)(void))
{
get_tid_callback = cb;
}
void
log_set_prefix (const char *text, unsigned int flags)
{
@ -460,7 +468,13 @@ do_logv (int level, const char *fmt, va_list arg_ptr)
if (with_prefix || force_prefixes)
fputs (prefix_buffer, logstream);
if (with_pid || force_prefixes)
fprintf (logstream, "[%u]", (unsigned int)getpid ());
{
if (get_tid_callback)
fprintf (logstream, "[%u.%lx]",
(unsigned int)getpid (), get_tid_callback ());
else
fprintf (logstream, "[%u]", (unsigned int)getpid ());
}
if (!with_time || force_prefixes)
putc (':', logstream);
/* A leading backspace suppresses the extra space so that we can