From 623fad67a576532a82c065e98b955da43266dcf4 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 30 Apr 2004 03:58:21 +0000 Subject: * 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. --- jnlib/logging.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'jnlib/logging.c') 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; -- cgit