summaryrefslogtreecommitdiff
path: root/toxcore
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2016-08-11 18:09:20 +0100
committeriphydf <iphydf@users.noreply.github.com>2016-08-11 18:14:54 +0100
commit5d26ce1cf5fb88f39a762b76c528a91690783840 (patch)
treedbc8e3da979c7d47d515ebeeb3f3988b8fee82d2 /toxcore
parentfc330c1fa55003fa02928e27e146ab388fa65cdd (diff)
Fix a bug I introduced that would make toxcore fail to initialise a second time.
sodium_init returns 1 when the library was already initialised. Toxcore code wasn't prepared to handle sodium errors, so it thought it was an allocation error. This error is still not handled correctly. If crypto fails to initialise, it will think it's an allocation error. Fixing this requires too many code changes, so must be done later.
Diffstat (limited to 'toxcore')
-rw-r--r--toxcore/network.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/toxcore/network.c b/toxcore/network.c
index 244512c0..9ce64aef 100644
--- a/toxcore/network.c
+++ b/toxcore/network.c
@@ -452,7 +452,7 @@ int networking_at_startup(void)
452 randombytes_stir(); 452 randombytes_stir();
453#else 453#else
454 454
455 if (sodium_init() != 0) 455 if (sodium_init() == -1)
456 return -1; 456 return -1;
457 457
458#endif /*USE_RANDOMBYTES_STIR*/ 458#endif /*USE_RANDOMBYTES_STIR*/