Have tincd and tincctl use the same method of determining netname.
This commit is contained in:
parent
1d322d2eda
commit
33521eabd4
2 changed files with 20 additions and 8 deletions
|
@ -187,11 +187,15 @@ static bool parse_options(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!netname) {
|
if(!netname && (netname = getenv("NETNAME")))
|
||||||
netname = getenv("NETNAME");
|
netname = xstrdup(netname);
|
||||||
if(netname)
|
|
||||||
netname = xstrdup(netname);
|
/* netname "." is special: a "top-level name" */
|
||||||
}
|
|
||||||
|
if(!strcmp(netname, ".")) {
|
||||||
|
free(netname);
|
||||||
|
netname = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
14
src/tincd.c
14
src/tincd.c
|
@ -177,9 +177,7 @@ static bool parse_options(int argc, char **argv) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'n': /* net name given */
|
case 'n': /* net name given */
|
||||||
/* netname "." is special: a "top-level name" */
|
netname = xstrdup(optarg);
|
||||||
netname = strcmp(optarg, ".") != 0 ?
|
|
||||||
xstrdup(optarg) : NULL;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'o': /* option */
|
case 'o': /* option */
|
||||||
|
@ -228,6 +226,16 @@ static bool parse_options(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!netname && (netname = getenv("NETNAME")))
|
||||||
|
netname = xstrdup(netname);
|
||||||
|
|
||||||
|
/* netname "." is special: a "top-level name" */
|
||||||
|
|
||||||
|
if(!strcmp(netname, ".")) {
|
||||||
|
free(netname);
|
||||||
|
netname = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue