X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fnames.c;h=fa3574b0ea24c7d2ee047a5880900f02f6cc3d67;hb=373b0c12d9d0e8a3b449fd18be704e28dd6403e1;hp=6db364e0f5c05c6c5eaea3c733747d71a6a60e11;hpb=f6e87ab476a0faf8b124ecaaa27f967d825e6457;p=tinc diff --git a/src/names.c b/src/names.c index 6db364e0..fa3574b0 100644 --- a/src/names.c +++ b/src/names.c @@ -1,7 +1,7 @@ /* names.c -- generate commonly used (file)names Copyright (C) 1998-2005 Ivo Timmermans - 2000-2017 Guus Sliepen + 2000-2018 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 @@ -39,7 +39,7 @@ char *program_name = NULL; Set all files and paths according to netname */ void make_names(bool daemon) { -#ifdef HAVE_MINGW +#ifdef HAVE_WINDOWS HKEY key; char installdir[1024] = ""; DWORD len = sizeof(installdir); @@ -50,13 +50,15 @@ void make_names(bool daemon) { logger(DEBUG_ALWAYS, LOG_INFO, "Both netname and configuration directory given, using the latter..."); } + free(identname); + if(netname) { xasprintf(&identname, "tinc.%s", netname); } else { identname = xstrdup("tinc"); } -#ifdef HAVE_MINGW +#ifdef HAVE_WINDOWS if(!RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\tinc", 0, KEY_READ, &key)) { if(!RegQueryValueEx(key, NULL, 0, 0, (LPBYTE)installdir, &len)) { @@ -92,7 +94,8 @@ void make_names(bool daemon) { } } -#ifdef HAVE_MINGW +#ifdef HAVE_WINDOWS + (void)daemon; if(!logfilename) { xasprintf(&logfilename, "%s" SLASH "log", confbase); @@ -147,7 +150,7 @@ void make_names(bool daemon) { #endif if(!unixsocketname) { - int len = strlen(pidfilename); + size_t len = strlen(pidfilename); unixsocketname = xmalloc(len + 8); memcpy(unixsocketname, pidfilename, len);