X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fkeys.c;h=0485c761330119ac0975073ceb9c6c58e711eecb;hb=6049b67f1e1cf00da8e0e913b8adc81a7b16bb87;hp=c857fb63503b5cfdf3bdd952b155b47f99417c92;hpb=7208397398f7e08d741bfa83594a88e5d01b6220;p=tinc diff --git a/src/keys.c b/src/keys.c index c857fb63..0485c761 100644 --- a/src/keys.c +++ b/src/keys.c @@ -21,7 +21,7 @@ bool disable_old_keys(const char *filename, const char *what) { return false; } - int result = snprintf(tmpfile, sizeof(tmpfile), "%s.tmp", filename); + size_t result = snprintf(tmpfile, sizeof(tmpfile), "%s.tmp", filename); if(result < sizeof(tmpfile)) { struct stat st = {.st_mode = 0600}; @@ -79,7 +79,7 @@ bool disable_old_keys(const char *filename, const char *what) { return false; } -#ifdef HAVE_MINGW +#ifdef HAVE_WINDOWS // We cannot atomically replace files on Windows. char bakfile[PATH_MAX] = ""; snprintf(bakfile, sizeof(bakfile), "%s.bak", filename); @@ -95,7 +95,7 @@ bool disable_old_keys(const char *filename, const char *what) { return false; } -#ifdef HAVE_MINGW +#ifdef HAVE_WINDOWS unlink(bakfile); #endif fprintf(stderr, "Warning: old key(s) found and disabled.\n"); @@ -128,7 +128,7 @@ ecdsa_t *read_ecdsa_private_key(splay_tree_t *config_tree, char **keyfile) { return NULL; } -#ifndef HAVE_MINGW +#ifndef HAVE_WINDOWS struct stat s; if(fstat(fileno(fp), &s)) { @@ -171,7 +171,7 @@ bool read_ecdsa_public_key(ecdsa_t **ecdsa, splay_tree_t **config_tree, const ch char *p; if(!*config_tree) { - init_configuration(config_tree); + *config_tree = create_configuration(); if(!read_host_config(*config_tree, name, true)) { return false; @@ -262,7 +262,7 @@ rsa_t *read_rsa_private_key(splay_tree_t *config_tree, char **keyfile) { return NULL; } -#ifndef HAVE_MINGW +#ifndef HAVE_WINDOWS struct stat s; if(fstat(fileno(fp), &s)) {