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>
Tue, 14 Apr 2015 09:21:19 +0000 (11:21 +0200)
On Windows, the log filename now defaults to "tinc.log" in the same
directory as tinc.conf.

src/tincd.c

index b6a6c29..fda20c4 100644 (file)
@@ -438,14 +438,14 @@ static void make_names(void) {
 #ifdef HAVE_MINGW
        if(!RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\tinc", 0, KEY_READ, &key)) {
                if(!RegQueryValueEx(key, NULL, 0, 0, (LPBYTE)installdir, &len)) {
-                       if(!logfilename)
-                               xasprintf(&logfilename, "%s/log/%s.log", identname);
                        if(!confbase) {
                                if(netname)
                                        xasprintf(&confbase, "%s/%s", installdir, netname);
                                else
                                        xasprintf(&confbase, "%s", installdir);
                        }
+                       if(!logfilename)
+                               xasprintf(&logfilename, "%s/tinc.log", confbase);
                }
                RegCloseKey(key);
                if(*installdir)