X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Ffsck.c;h=28da620e02cefef48b03fdab373046ac3d63dbde;hb=c44b08613508c993e7fd9f625e0b1b4775efffed;hp=5c7762a8addff54d41e14eb4abe22a736ea52407;hpb=6debc6c79ba385d35f646e0958f84ace5b8f4b4d;p=tinc diff --git a/src/fsck.c b/src/fsck.c index 5c7762a8..28da620e 100644 --- a/src/fsck.c +++ b/src/fsck.c @@ -1,6 +1,6 @@ /* fsck.c -- Check the configuration files for problems - Copyright (C) 2014-2021 Guus Sliepen + Copyright (C) 2014-2022 Guus Sliepen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -141,8 +141,9 @@ static void check_conffile(const char *nodename, bool server) { ++total_vars; } - int count[total_vars]; - memset(count, 0, sizeof(count)); + const size_t countlen = total_vars * sizeof(int); + int *count = alloca(countlen); + memset(count, 0, countlen); for splay_each(config_t, conf, &config) { int var_type = 0; @@ -184,10 +185,10 @@ static void check_conffile(const char *nodename, bool server) { splay_empty_tree(&config); } -#ifdef HAVE_MINGW +#ifdef HAVE_WINDOWS typedef int uid_t; -static uid_t getuid() { +static uid_t getuid(void) { return 0; } @@ -218,9 +219,9 @@ static void check_key_file_mode(const char *fname) { } } } -#endif // HAVE_MINGW +#endif // HAVE_WINDOWS -static char *read_node_name() { +static char *read_node_name(void) { if(access(tinc_conf, R_OK) == 0) { return get_my_name(true); } @@ -438,7 +439,7 @@ static bool check_config_mode(const char *fname) { return true; } -static bool check_script_confdir() { +static bool check_script_confdir(void) { char fname[PATH_MAX]; DIR *dir = opendir(confbase); @@ -540,9 +541,7 @@ static bool check_public_keys(splay_tree_t *config, const char *name, rsa_t *rsa bool success = true; #ifndef DISABLE_LEGACY - rsa_t *rsa_pub = NULL; - read_rsa_public_key(&rsa_pub, config, name); - + rsa_t *rsa_pub = read_rsa_public_key(config, name); success = check_rsa_pubkey(rsa_priv, rsa_pub, host_file); rsa_free(rsa_pub); #endif @@ -616,7 +615,7 @@ static void check_config_variables(const char *host_dir) { } } -static bool check_scripts_and_configs() { +static bool check_scripts_and_configs(void) { // Check whether scripts are executable. if(!check_script_confdir()) { return false;