Fix --logfile without a filename on Windows.
authorGuus Sliepen <guus@tinc-vpn.org>
Tue, 14 Apr 2015 09:20:24 +0000 (11:20 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Sun, 10 Apr 2016 15:28:42 +0000 (17:28 +0200)
On Windows, the log filename now defaults to "tinc.log" in the same
directory as tinc.conf.

# Conflicts:
# src/tincd.c

src/names.c

index 2782dd362fa0a5bc796b1ac3189ffdcc8279c5ca..47729daceef451deab1d43a3e80c705d7e0590ee 100644 (file)
@@ -57,14 +57,14 @@ void make_names(bool daemon) {
        if(!RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\tinc", 0, KEY_READ, &key)) {
                if(!RegQueryValueEx(key, NULL, 0, 0, (LPBYTE)installdir, &len)) {
                        confdir = xstrdup(installdir);
-                       if(!logfilename)
-                               xasprintf(&logfilename, "%s" SLASH "log" SLASH "%s.log", installdir, identname);
                        if(!confbase) {
                                if(netname)
                                        xasprintf(&confbase, "%s" SLASH "%s", installdir, netname);
                                else
                                        xasprintf(&confbase, "%s", installdir);
                        }
+                       if(!logfilename)
+                               xasprintf(&logfilename, "%s" SLASH "tinc.log", confbase);
                }
                RegCloseKey(key);
        }