From 71882edfbd2620b3fb4cbb688f0f479bf2ba3c6d Mon Sep 17 00:00:00 2001 From: Saverio Proto Date: Tue, 17 Jun 2014 18:11:12 +0200 Subject: [PATCH] Fixing segmentation faults because of missing initializations --- src/meshlink.c | 2 ++ src/net_setup.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) 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]; -- 2.39.5