From: Saverio Proto Date: Tue, 17 Jun 2014 16:11:12 +0000 (+0200) Subject: Fixing segmentation faults because of missing initializations X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=71882edfbd2620b3fb4cbb688f0f479bf2ba3c6d;p=meshlink Fixing segmentation faults because of missing initializations --- diff --git a/src/meshlink.c b/src/meshlink.c index 31f2410c..2e6a37cc 100644 --- a/src/meshlink.c +++ b/src/meshlink.c @@ -739,6 +739,8 @@ meshlink_handle_t *meshlink_open(const char *confbase, const char *name) { if (usingname) mesh->name = xstrdup(name); mesh->self = new_node(); mesh->self->connection = new_connection(); + if(!read_ecdsa_private_key(mesh)) + return false; pthread_mutex_init ( &(mesh->outpacketqueue_mutex), NULL); pthread_mutex_init ( &(mesh->nodes_mutex), NULL); mesh->threadstarted = false; diff --git a/src/net_setup.c b/src/net_setup.c index 4ee4b953..97ef4f13 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -80,7 +80,7 @@ bool read_ecdsa_public_key(meshlink_handle_t *mesh, connection_t *c) { return false; } -static bool read_ecdsa_private_key(meshlink_handle_t *mesh) { +bool read_ecdsa_private_key(meshlink_handle_t *mesh) { FILE *fp; char filename[PATH_MAX];