From: Guus Sliepen Date: Sat, 21 Jul 2012 13:58:16 +0000 (+0200) Subject: Don't try to mkdir(CONFDIR) on Windows when there is a registry key for tinc. X-Git-Tag: release-1.1pre3~85 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=09a8ff649cc7aa51d291c89e1556526a6265cc81;p=oweals%2Ftinc.git Don't try to mkdir(CONFDIR) on Windows when there is a registry key for tinc. --- diff --git a/src/tincctl.c b/src/tincctl.c index ca354bc..0337392 100644 --- a/src/tincctl.c +++ b/src/tincctl.c @@ -47,6 +47,7 @@ static bool show_version = false; static char *name = NULL; static char *identname = NULL; /* program name for syslog */ static char *pidfilename = NULL; /* pid file location */ +static char *confdir = NULL; static char controlcookie[1024]; char *netname = NULL; char *confbase = NULL; @@ -400,6 +401,7 @@ static void make_names(void) { if(!*installdir) { #endif + confdir = xstrdup(CONFDIR); if(!pidfilename) xasprintf(&pidfilename, "%s/run/%s.pid", LOCALSTATEDIR, identname); @@ -415,7 +417,8 @@ static void make_names(void) { } #ifdef HAVE_MINGW - } + } else + confdir = xstrdup(installdir); #endif xasprintf(&tinc_conf, "%s/tinc.conf", confbase); @@ -1348,7 +1351,7 @@ static int cmd_init(int argc, char *argv[]) { return 1; } - if(mkdir(CONFDIR, 0755) && errno != EEXIST) { + if(mkdir(confdir, 0755) && errno != EEXIST) { fprintf(stderr, "Could not create directory %s: %s\n", CONFDIR, strerror(errno)); return 1; }