From 84ebd2f34882d29510f819a797fade0297fe9ab9 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 27 Nov 2017 14:47:11 +0100 Subject: core: Avoid endless recursion if log_set_sink has not been used. * src/logging.c (_gpgrt_log_set_sink): Do not call gf_is_valid if the default sink has been requested. Signed-off-by: Werner Koch --- src/logging.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/logging.c') diff --git a/src/logging.c b/src/logging.c index dbd8066..13873eb 100644 --- a/src/logging.c +++ b/src/logging.c @@ -559,7 +559,8 @@ set_file_fd (const char *name, int fd) * "socket:///home/foo/mylogs" may be used to write the logging to the * socket "/home/foo/mylogs". If the connection to the socket fails * or a write error is detected, the function writes to stderr and - * tries the next time again to connect the socket. + * tries the next time again to connect the socket. Calling this + * function with (NULL, NULL, -1) sets the default sink. * Warning: This function is not thread-safe. */ void @@ -567,7 +568,7 @@ _gpgrt_log_set_sink (const char *name, estream_t stream, int fd) { if (name && !stream && fd == -1) set_file_fd (name, -1); - else if (!name && !stream) + else if (!name && !stream && fd != -1) { if (!_gpgrt_fd_valid_p (fd)) _gpgrt_log_fatal ("gpgrt_log_set_sink: fd is invalid: %s\n", -- cgit v1.2.3