/*
fsck.c -- Check the configuration files for problems
- Copyright (C) 2014-2021 Guus Sliepen <guus@tinc-vpn.org>
+ Copyright (C) 2014-2022 Guus Sliepen <guus@tinc-vpn.org>
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
goto again;
}
+static void print_tinc_cmd(const char *format, ...) ATTR_FORMAT(printf, 1, 2);
static void print_tinc_cmd(const char *format, ...) {
if(confbasegiven) {
fprintf(stderr, "%s -c %s ", exe_name, confbase);
++total_vars;
}
- int count[total_vars];
- memset(count, 0, sizeof(count));
+ if(!total_vars) {
+ splay_empty_tree(&config);
+ return;
+ }
+
+ 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;
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;
}
}
}
}
-#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);
}
return true;
}
-static bool check_script_confdir() {
+static bool check_script_confdir(void) {
char fname[PATH_MAX];
DIR *dir = opendir(confbase);
fprintf(stderr, "WARNING: cannot read %s\n", host_file);
}
- ecdsa_t *ec_pub = NULL;
- read_ecdsa_public_key(&ec_pub, &config, name);
+ ecdsa_t *ec_pub = read_ecdsa_public_key(&config, name);
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
}
}
-static bool check_scripts_and_configs() {
+static bool check_scripts_and_configs(void) {
// Check whether scripts are executable.
if(!check_script_confdir()) {
return false;