summaryrefslogtreecommitdiff
path: root/src/logging.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2017-11-27 14:47:11 +0100
committerWerner Koch <wk@gnupg.org>2017-11-27 14:47:11 +0100
commit84ebd2f34882d29510f819a797fade0297fe9ab9 (patch)
tree9c5a1f79c986a8f20df9a629992b81ee4de52260 /src/logging.c
parentd1e3401013f85620f3136958be079c13ca758b20 (diff)
downloadlibgpg-error-84ebd2f34882d29510f819a797fade0297fe9ab9.tar.gz
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 <wk@gnupg.org>
Diffstat (limited to 'src/logging.c')
-rw-r--r--src/logging.c5
1 files changed, 3 insertions, 2 deletions
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",