Better default paths for log and PID files on Windows.

This commit is contained in:
Guus Sliepen 2014-12-27 09:08:34 +01:00
parent b78436ff1e
commit 26d3ee0dd9

View file

@ -64,8 +64,6 @@ void make_names(void) {
else else
xasprintf(&confbase, "%s", installdir); xasprintf(&confbase, "%s", installdir);
} }
if(!pidfilename)
xasprintf(&pidfilename, "%s" SLASH "pid", confbase);
} }
RegCloseKey(key); RegCloseKey(key);
} }
@ -73,11 +71,26 @@ void make_names(void) {
if(!confdir) if(!confdir)
confdir = xstrdup(CONFDIR SLASH "tinc"); confdir = xstrdup(CONFDIR SLASH "tinc");
if(!confbase) {
if(netname)
xasprintf(&confbase, CONFDIR SLASH "tinc" SLASH "%s", netname);
else
xasprintf(&confbase, CONFDIR SLASH "tinc");
}
#ifdef HAVE_MINGW
if(!logfilename)
xasprintf(&logfilename, "%s" SLASH "log", confbase);
if(!pidfilename)
xasprintf(&pidfilename, "%s" SLASH "pid", confbase);
#else
if(!logfilename) if(!logfilename)
xasprintf(&logfilename, LOCALSTATEDIR SLASH "log" SLASH "%s.log", identname); xasprintf(&logfilename, LOCALSTATEDIR SLASH "log" SLASH "%s.log", identname);
if(!pidfilename) if(!pidfilename)
xasprintf(&pidfilename, LOCALSTATEDIR SLASH "run" SLASH "%s.pid", identname); xasprintf(&pidfilename, LOCALSTATEDIR SLASH "run" SLASH "%s.pid", identname);
#endif
if(!unixsocketname) { if(!unixsocketname) {
int len = strlen(pidfilename); int len = strlen(pidfilename);
@ -88,13 +101,6 @@ void make_names(void) {
else else
strcpy(unixsocketname + len, ".socket"); strcpy(unixsocketname + len, ".socket");
} }
if(!confbase) {
if(netname)
xasprintf(&confbase, CONFDIR SLASH "tinc" SLASH "%s", netname);
else
xasprintf(&confbase, CONFDIR SLASH "tinc");
}
} }
void free_names(void) { void free_names(void) {