char *confdir = NULL; /* base configuration directory */
char *confbase = NULL; /* base configuration directory for this instance of tinc */
char *identname = NULL; /* program name for syslog */
+char *unixsocketname = NULL; /* UNIX socket location */
char *logfilename = NULL; /* log file location */
char *pidfilename = NULL;
char *program_name = NULL;
}
#endif
if(!confdir)
- confdir = xstrdup(CONFDIR);
+ confdir = xstrdup(CONFDIR SLASH "tinc");
if(!logfilename)
xasprintf(&logfilename, LOCALSTATEDIR SLASH "log" SLASH "%s.log", identname);
if(!pidfilename)
xasprintf(&pidfilename, LOCALSTATEDIR SLASH "run" SLASH "%s.pid", identname);
+ if(!unixsocketname) {
+ int len = strlen(pidfilename);
+ unixsocketname = xmalloc(len + 8);
+ strcpy(unixsocketname, pidfilename);
+ if(len > 4 && !strcmp(pidfilename + len - 4, ".pid"))
+ strcpy(unixsocketname + len - 4, ".socket");
+ else
+ strcpy(unixsocketname + len, ".socket");
+ }
+
if(netname) {
if(!confbase)
xasprintf(&confbase, CONFDIR SLASH "tinc" SLASH "%s", netname);
void free_names(void) {
free(identname);
free(netname);
+ free(unixsocketname);
free(pidfilename);
free(logfilename);
free(confbase);