- if(!unixsocketname)
- xasprintf(&unixsocketname, LOCALSTATEDIR SLASH "run" SLASH "%s.socket", identname);
-
- if(netname) {
- if(!confbase)
- xasprintf(&confbase, CONFDIR SLASH "tinc" SLASH "%s", netname);
+ 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");