X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Ftincctl.c;h=d46a378bd04bd2e7c6f0083743b340aa8d9c7280;hb=4b2ddded2c8ae1a1a5930637552eeb48f30d6530;hp=04fbdd5238b0166e7b36998972568efe9b85bed3;hpb=268e3ffca7b45cfc736e1bc9bec7a113c6c45701;p=tinc diff --git a/src/tincctl.c b/src/tincctl.c index 04fbdd52..d46a378b 100644 --- a/src/tincctl.c +++ b/src/tincctl.c @@ -1610,6 +1610,11 @@ static int cmd_config(int argc, char *argv[]) { } set = true; continue; + // Add + } else if(action > 0) { + // Check if we've already seen this variable with the same value + if(!strcasecmp(bvalue, value)) + found = true; } } @@ -1642,7 +1647,7 @@ static int cmd_config(int argc, char *argv[]) { } // Add new variable if necessary. - if(action > 0 || (action == 0 && !set)) { + if((action > 0 && !found)|| (action == 0 && !set)) { if(fprintf(tf, "%s = %s\n", variable, value) < 0) { fprintf(stderr, "Error writing to temporary file %s: %s\n", tmpfile, strerror(errno)); return 1;