projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'winevents-clean' of https://github.com/dechamps/tinc into 1.1
[tinc]
/
src
/
names.c
diff --git
a/src/names.c
b/src/names.c
index
688e96d
..
37708f8
100644
(file)
--- a/
src/names.c
+++ b/
src/names.c
@@
-26,6
+26,7
@@
char *netname = NULL;
char *confdir = NULL; /* base configuration directory */
char *confbase = NULL; /* base configuration directory for this instance of tinc */
char *netname = NULL;
char *confdir = NULL; /* base configuration directory */
char *confbase = NULL; /* base configuration directory for this instance of tinc */
+bool confbase_given;
char *identname = NULL; /* program name for syslog */
char *unixsocketname = NULL; /* UNIX socket location */
char *logfilename = NULL; /* log file location */
char *identname = NULL; /* program name for syslog */
char *unixsocketname = NULL; /* UNIX socket location */
char *logfilename = NULL; /* log file location */
@@
-39,8
+40,12
@@
void make_names(void) {
#ifdef HAVE_MINGW
HKEY key;
char installdir[1024] = "";
#ifdef HAVE_MINGW
HKEY key;
char installdir[1024] = "";
-
long
len = sizeof installdir;
+
DWORD
len = sizeof installdir;
#endif
#endif
+ confbase_given = confbase;
+
+ if(netname && confbase)
+ logger(DEBUG_ALWAYS, LOG_INFO, "Both netname and configuration directory given, using the latter...");
if(netname)
xasprintf(&identname, "tinc.%s", netname);
if(netname)
xasprintf(&identname, "tinc.%s", netname);
@@
-49,7
+54,7
@@
void make_names(void) {
#ifdef HAVE_MINGW
if(!RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\tinc", 0, KEY_READ, &key)) {
#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);
confdir = xstrdup(installdir);
if(!logfilename)
xasprintf(&logfilename, "%s" SLASH "log" SLASH "%s.log", installdir, identname);
@@
-84,13
+89,10
@@
void make_names(void) {
strcpy(unixsocketname + len, ".socket");
}
strcpy(unixsocketname + len, ".socket");
}
- if(
netnam
e) {
- if(
!confbas
e)
+ if(
!confbas
e) {
+ if(
netnam
e)
xasprintf(&confbase, CONFDIR SLASH "tinc" SLASH "%s", netname);
else
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");
}
}
xasprintf(&confbase, CONFDIR SLASH "tinc");
}
}