summaryrefslogtreecommitdiffstats
path: root/jnlib
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2004-04-30 05:58:21 +0200
committerWerner Koch <wk@gnupg.org>2004-04-30 05:58:21 +0200
commit623fad67a576532a82c065e98b955da43266dcf4 (patch)
tree258194bab553543438ba52c5c46febce1c2dfe5a /jnlib
parent(check_and_store): Do not update the stats for hidden (diff)
downloadgnupg2-623fad67a576532a82c065e98b955da43266dcf4.tar.xz
gnupg2-623fad67a576532a82c065e98b955da43266dcf4.zip
* gpg-agent.c (parse_rereadable_options): New arg REREAD. Allow
changing oLogFile. (current_logfile): New. * logging.c (log_set_file): Make sure the log stream will be closed even if the stderr fileno will be assigned to a new socket.
Diffstat (limited to 'jnlib')
-rw-r--r--jnlib/ChangeLog5
-rw-r--r--jnlib/logging.c9
2 files changed, 13 insertions, 1 deletions
diff --git a/jnlib/ChangeLog b/jnlib/ChangeLog
index 99c9177b5..1527fb773 100644
--- a/jnlib/ChangeLog
+++ b/jnlib/ChangeLog
@@ -1,3 +1,8 @@
+2004-04-30 Werner Koch <wk@gnupg.org>
+
+ * logging.c (log_set_file): Make sure the log stream will be
+ closed even if the stderr fileno will be assigned to a new socket.
+
2004-04-16 Werner Koch <wk@gnupg.org>
* logging.h (JNLIB_LOG_WITH_PREFIX): Add constants for the flag
diff --git a/jnlib/logging.c b/jnlib/logging.c
index fdf2d7fcb..7397ddd30 100644
--- a/jnlib/logging.c
+++ b/jnlib/logging.c
@@ -211,7 +211,7 @@ fun_closer (void *cookie_arg)
-/* Set the file to write log to. The sepcial names NULL and "_" may
+/* Set the file to write log to. The special names NULL and "-" may
be used to select stderr and names formatted like
"socket:///home/foo/mylogs" may be used to write the logging to the
socket "/home/foo/mylogs". If the connection to the socket fails
@@ -258,6 +258,13 @@ log_set_file (const char *name)
/* We always need to print the prefix and the pid, so that the
server reading the socket can do something meanigful. */
force_prefixes = 1;
+ /* On success close the old logstream right now, so that we are
+ really sure it has been closed. */
+ if (fp)
+ {
+ fclose (logstream);
+ logstream = NULL;
+ }
}
else
fp = (name && strcmp(name,"-"))? fopen (name, "a") : stderr;