diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-03-17 14:48:34 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-03-17 15:04:03 +0000 |
commit | 9706d9a0f015a58937255abd95101045ab865796 (patch) | |
tree | f80d6558912e09b22b4f0c44440e54f92fd40cae /toxcore/Messenger.c | |
parent | a2496af71aeed3cd7324fb59d9f32c2d52759d56 (diff) |
Disallow stderr logger by default.
Diffstat (limited to 'toxcore/Messenger.c')
-rw-r--r-- | toxcore/Messenger.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index 4a24ae5f..2408c844 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c | |||
@@ -1977,26 +1977,24 @@ Messenger *new_messenger(Messenger_Options *options, unsigned int *error) | |||
1977 | return nullptr; | 1977 | return nullptr; |
1978 | } | 1978 | } |
1979 | 1979 | ||
1980 | Logger *log = nullptr; | 1980 | m->log = logger_new(); |
1981 | 1981 | ||
1982 | if (options->log_callback) { | 1982 | if (m->log == nullptr) { |
1983 | log = logger_new(); | 1983 | friendreq_kill(m->fr); |
1984 | 1984 | free(m); | |
1985 | if (log != nullptr) { | 1985 | return nullptr; |
1986 | logger_callback_log(log, options->log_callback, m, options->log_user_data); | ||
1987 | } | ||
1988 | } | 1986 | } |
1989 | 1987 | ||
1990 | m->log = log; | 1988 | logger_callback_log(m->log, options->log_callback, m, options->log_user_data); |
1991 | 1989 | ||
1992 | unsigned int net_err = 0; | 1990 | unsigned int net_err = 0; |
1993 | 1991 | ||
1994 | if (options->udp_disabled) { | 1992 | if (options->udp_disabled) { |
1995 | m->net = new_networking_no_udp(log); | 1993 | m->net = new_networking_no_udp(m->log); |
1996 | } else { | 1994 | } else { |
1997 | IP ip; | 1995 | IP ip; |
1998 | ip_init(&ip, options->ipv6enabled); | 1996 | ip_init(&ip, options->ipv6enabled); |
1999 | m->net = new_networking_ex(log, ip, options->port_range[0], options->port_range[1], &net_err); | 1997 | m->net = new_networking_ex(m->log, ip, options->port_range[0], options->port_range[1], &net_err); |
2000 | } | 1998 | } |
2001 | 1999 | ||
2002 | if (m->net == nullptr) { | 2000 | if (m->net == nullptr) { |