diff options
author | Werner Koch <wk@gnupg.org> | 2017-11-27 14:47:11 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2017-11-27 14:47:11 +0100 |
commit | 84ebd2f34882d29510f819a797fade0297fe9ab9 (patch) | |
tree | 9c5a1f79c986a8f20df9a629992b81ee4de52260 /src/logging.c | |
parent | d1e3401013f85620f3136958be079c13ca758b20 (diff) | |
download | libgpg-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.c | 5 |
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", |