From 09a8ff649cc7aa51d291c89e1556526a6265cc81 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Sat, 21 Jul 2012 15:58:16 +0200 Subject: [PATCH] Don't try to mkdir(CONFDIR) on Windows when there is a registry key for tinc. --- src/tincctl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/tincctl.c b/src/tincctl.c index ca354bc0..03373926 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; } -- 2.20.1