]> git.meshlink.io Git - meshlink/commitdiff
Treat netname="." in a special way.
authorMichael Tokarev <mjt@tls.msk.ru>
Sun, 24 Oct 2010 11:23:10 +0000 (15:23 +0400)
committerGuus Sliepen <guus@tinc-vpn.org>
Sun, 24 Oct 2010 11:32:36 +0000 (13:32 +0200)
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>
src/tincd.c

index a618e63f0d9158f78ba813b0efbb660599da8684..3dab9a01157b5751c14a65f24fc3d82ae94ea94f 100644 (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 */