Don't try to create tinc.conf when using set or add commands.
It is almost certainly an error. If one really wants to create a new tinc.conf file, one should use the init command.
This commit is contained in:
parent
8e732fcbbb
commit
43c72093ad
1 changed files with 2 additions and 13 deletions
|
|
@ -1437,21 +1437,10 @@ static int cmd_config(int argc, char *argv[]) {
|
||||||
|
|
||||||
FILE *f = fopen(filename, "r");
|
FILE *f = fopen(filename, "r");
|
||||||
if(!f) {
|
if(!f) {
|
||||||
if(action < 0 || errno != ENOENT) {
|
|
||||||
fprintf(stderr, "Could not open configuration file %s: %s\n", filename, strerror(errno));
|
fprintf(stderr, "Could not open configuration file %s: %s\n", filename, strerror(errno));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If it doesn't exist, create it.
|
|
||||||
f = fopen(filename, "a+");
|
|
||||||
if(!f) {
|
|
||||||
fprintf(stderr, "Could not create configuration file %s: %s\n", filename, strerror(errno));
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
fprintf(stderr, "Created configuration file %s.\n", filename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
char *tmpfile = NULL;
|
char *tmpfile = NULL;
|
||||||
FILE *tf = NULL;
|
FILE *tf = NULL;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue