X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fconf.c;h=5231a9dfca25fc16c1a8fd3fbf63b9c0a8001081;hb=ad85858f2a2383af2cf0bcdede7de11dcf60aa8f;hp=a53db04604ed10bc8725053a38bb9d33edfb84b8;hpb=d959cb6c3232507db9ef0cb0873a934255e70bf0;p=meshlink diff --git a/src/conf.c b/src/conf.c index a53db046..5231a9df 100644 --- a/src/conf.c +++ b/src/conf.c @@ -51,7 +51,8 @@ void init_configuration(splay_tree_t **config_tree) { } void exit_configuration(splay_tree_t **config_tree) { - splay_delete_tree(*config_tree); + if(*config_tree) + splay_delete_tree(*config_tree); *config_tree = NULL; } @@ -323,10 +324,9 @@ bool append_config_file(meshlink_handle_t *mesh, const char *name, const char *k if(!fp) { logger(DEBUG_ALWAYS, LOG_ERR, "Cannot open config file %s: %s", filename, strerror(errno)); } else { - fprintf(fp, "\n# The following line was automatically added by tinc\n%s = %s\n", key, value); + fprintf(fp, "%s = %s\n", key, value); fclose(fp); } - return fp != NULL; }