mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
Finished the bulk of changes to use estream in most places instead of
stdio.
This commit is contained in:
parent
37870234a1
commit
fb2ba98963
32 changed files with 824 additions and 711 deletions
|
@ -283,32 +283,7 @@ set_file_fd (const char *name, int fd)
|
|||
|
||||
/* On error default to a stderr based estream. */
|
||||
if (!fp)
|
||||
{
|
||||
fp = es_fpopen (stderr, "a");
|
||||
if (fp)
|
||||
{
|
||||
if (name)
|
||||
es_fprintf (fp, "failed to open log file `%s': %s\n",
|
||||
name, strerror (errno));
|
||||
else
|
||||
es_fprintf (fp, "failed to fdopen file descriptor %d: %s\n",
|
||||
fd, strerror (errno));
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "failed to use stderr as log stream: %s\n",
|
||||
strerror (errno));
|
||||
/* No way to log something. Create a dummy estream so that
|
||||
there is something we can use. */
|
||||
fp = es_fpopen (NULL, "a");
|
||||
if (!fp)
|
||||
{
|
||||
fprintf (stderr, "fatal: failed to open dummy stream: %s\n",
|
||||
strerror (errno));
|
||||
abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
fp = es_stderr;
|
||||
|
||||
es_setvbuf (fp, NULL, _IOLBF, 0);
|
||||
|
||||
|
@ -605,6 +580,16 @@ log_printf (const char *fmt, ...)
|
|||
}
|
||||
|
||||
|
||||
/* Flush the log - this is useful to make sure that the trailing
|
||||
linefeed has been printed. */
|
||||
void
|
||||
log_flush (void)
|
||||
{
|
||||
volatile va_list dummy_arg_ptr;
|
||||
do_logv (JNLIB_LOG_CONT, 1, NULL, dummy_arg_ptr);
|
||||
}
|
||||
|
||||
|
||||
/* Print a hexdump of BUFFER. With TEXT of NULL print just the raw
|
||||
dump, with TEXT just an empty string, print a trailing linefeed,
|
||||
otherwise print an entire debug line. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue