From 67f637a1e10aeb2a701d24e6b41849a96fbfef08 Mon Sep 17 00:00:00 2001 From: Jfreegman Date: Thu, 14 Aug 2014 21:31:28 -0400 Subject: [PATCH] redirect stderr before audio init to prevent error spam --- src/toxic.c | 8 ++++---- src/toxic.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/toxic.c b/src/toxic.c index 147402e..7a43f29 100644 --- a/src/toxic.c +++ b/src/toxic.c @@ -700,6 +700,10 @@ int main(int argc, char *argv[]) Tox *m = init_tox(); init_term(); + /* Redirect stderr to /dev/null + NOTE: Might not be best solution. Comment out for debugging. */ + freopen("/dev/null", "w", stderr); + if (m == NULL) exit_toxic_err("failed in main", FATALERR_NETWORKINIT); @@ -752,10 +756,6 @@ int main(int argc, char *argv[]) line_info_add(prompt, NULL, NULL, NULL, SYS_MSG, 0, 0, "%s", msg); } - /* Redirect stderr to /dev/null - NOTE: Might not be best solution. Comment out for debugging. */ - freopen("/dev/null", "w", stderr); - uint64_t last_save = (uint64_t) time(NULL); uint64_t looptimer = last_save; useconds_t msleepval = 40000; diff --git a/src/toxic.h b/src/toxic.h index a20d567..317c0d0 100644 --- a/src/toxic.h +++ b/src/toxic.h @@ -78,7 +78,7 @@ typedef enum _FATAL_ERRS { FATALERR_NETWORKINIT = -8, /* Tox network failed to init */ FATALERR_INFLOOP = -9, /* infinite loop detected */ FATALERR_WININIT = -10, /* window init failed */ - FATALERR_PROXY = -11, /* Tox network failed to iti using a proxy */ + FATALERR_PROXY = -11, /* Tox network failed to init using a proxy */ } FATAL_ERRS; /* Fixes text color problem on some terminals.