Don't try to mkdir(CONFDIR) if --config is used.
This commit is contained in:
parent
c25c684a84
commit
e11daa2646
4 changed files with 5 additions and 2 deletions
|
@ -823,7 +823,7 @@ int cmd_join(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure confbase exists and is accessible.
|
// Make sure confbase exists and is accessible.
|
||||||
if(strcmp(confdir, confbase) && mkdir(confdir, 0755) && errno != EEXIST) {
|
if(!confbase_given && mkdir(confdir, 0755) && errno != EEXIST) {
|
||||||
fprintf(stderr, "Could not create directory %s: %s\n", confdir, strerror(errno));
|
fprintf(stderr, "Could not create directory %s: %s\n", confdir, strerror(errno));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
char *netname = NULL;
|
char *netname = NULL;
|
||||||
char *confdir = NULL; /* base configuration directory */
|
char *confdir = NULL; /* base configuration directory */
|
||||||
char *confbase = NULL; /* base configuration directory for this instance of tinc */
|
char *confbase = NULL; /* base configuration directory for this instance of tinc */
|
||||||
|
bool confbase_given;
|
||||||
char *identname = NULL; /* program name for syslog */
|
char *identname = NULL; /* program name for syslog */
|
||||||
char *unixsocketname = NULL; /* UNIX socket location */
|
char *unixsocketname = NULL; /* UNIX socket location */
|
||||||
char *logfilename = NULL; /* log file location */
|
char *logfilename = NULL; /* log file location */
|
||||||
|
@ -41,6 +42,7 @@ void make_names(void) {
|
||||||
char installdir[1024] = "";
|
char installdir[1024] = "";
|
||||||
DWORD len = sizeof installdir;
|
DWORD len = sizeof installdir;
|
||||||
#endif
|
#endif
|
||||||
|
confbase_given = confbase;
|
||||||
|
|
||||||
if(netname && confbase)
|
if(netname && confbase)
|
||||||
logger(DEBUG_ALWAYS, LOG_INFO, "Both netname and configuration directory given, using the latter...");
|
logger(DEBUG_ALWAYS, LOG_INFO, "Both netname and configuration directory given, using the latter...");
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
extern char *confdir;
|
extern char *confdir;
|
||||||
extern char *confbase;
|
extern char *confbase;
|
||||||
|
extern bool confbase_given;
|
||||||
extern char *netname;
|
extern char *netname;
|
||||||
extern char *identname;
|
extern char *identname;
|
||||||
extern char *unixsocketname;
|
extern char *unixsocketname;
|
||||||
|
|
|
@ -1739,7 +1739,7 @@ static int cmd_init(int argc, char *argv[]) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strcmp(confdir, confbase) && mkdir(confdir, 0755) && errno != EEXIST) {
|
if(!confbase_given && mkdir(confdir, 0755) && errno != EEXIST) {
|
||||||
fprintf(stderr, "Could not create directory %s: %s\n", confdir, strerror(errno));
|
fprintf(stderr, "Could not create directory %s: %s\n", confdir, strerror(errno));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue