X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fnames.c;h=a631ad97e7fcde60c0216e66d7324bf55952db72;hb=09b0b49b98cc16f6b281e4e635c2c70234e38865;hp=688e96d35b31f216b534af7f8eb72d3da9dae779;hpb=a8b52becbbd86a52dc50a6a1b725a80737f2c760;p=tinc diff --git a/src/names.c b/src/names.c index 688e96d3..a631ad97 100644 --- a/src/names.c +++ b/src/names.c @@ -39,9 +39,12 @@ void make_names(void) { #ifdef HAVE_MINGW HKEY key; char installdir[1024] = ""; - long len = sizeof installdir; + DWORD len = sizeof installdir; #endif + if(netname && confbase) + logger(DEBUG_ALWAYS, LOG_INFO, "Both netname and configuration directory given, using the latter..."); + if(netname) xasprintf(&identname, "tinc.%s", netname); else @@ -49,7 +52,7 @@ void make_names(void) { #ifdef HAVE_MINGW if(!RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\tinc", 0, KEY_READ, &key)) { - if(!RegQueryValueEx(key, NULL, 0, 0, installdir, &len)) { + if(!RegQueryValueEx(key, NULL, 0, 0, (LPBYTE)installdir, &len)) { confdir = xstrdup(installdir); if(!logfilename) xasprintf(&logfilename, "%s" SLASH "log" SLASH "%s.log", installdir, identname); @@ -84,13 +87,10 @@ void make_names(void) { strcpy(unixsocketname + len, ".socket"); } - if(netname) { - if(!confbase) + if(!confbase) { + if(netname) xasprintf(&confbase, CONFDIR SLASH "tinc" SLASH "%s", netname); else - logger(DEBUG_ALWAYS, LOG_INFO, "Both netname and configuration directory given, using the latter..."); - } else { - if(!confbase) xasprintf(&confbase, CONFDIR SLASH "tinc"); } }