Treat netname="." in a special way.

Treat netname "." in a special way as if there was no netname
specified.  Before, f.e. tincd -n. -k didn't work as it tried
to open /var/run/tinc-.pid.  Now -n. works as if there was no
-n option is specified.

Signed-Off-By: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
Michael Tokarev 2010-10-24 15:23:10 +04:00 committed by Guus Sliepen
parent 5f729f76f5
commit aca70cd3c3

View file

@ -221,7 +221,9 @@ static bool parse_options(int argc, char **argv) {
break;
case 'n': /* net name given */
netname = xstrdup(optarg);
/* netname "." is special: a "top-level name" */
netname = strcmp(optarg, ".") != 0 ?
xstrdup(optarg) : NULL;
break;
case 'o': /* option */