projects
/
tinc
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1d322d2
)
Have tincd and tincctl use the same method of determining netname.
author
Guus Sliepen
<guus@tinc-vpn.org>
Sat, 21 Jul 2012 13:15:04 +0000
(15:15 +0200)
committer
Guus Sliepen
<guus@tinc-vpn.org>
Sat, 21 Jul 2012 13:15:04 +0000
(15:15 +0200)
src/tincctl.c
patch
|
blob
|
history
src/tincd.c
patch
|
blob
|
history
diff --git
a/src/tincctl.c
b/src/tincctl.c
index
a3688ec
..
f547639
100644
(file)
--- a/
src/tincctl.c
+++ b/
src/tincctl.c
@@
-187,11
+187,15
@@
static bool parse_options(int argc, char **argv) {
}
}
}
}
- if(!netname) {
- netname = getenv("NETNAME");
- if(netname)
- netname = xstrdup(netname);
- }
+ 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;
}
diff --git
a/src/tincd.c
b/src/tincd.c
index
9f65bbe
..
85aee39
100644
(file)
--- a/
src/tincd.c
+++ b/
src/tincd.c
@@
-177,9
+177,7
@@
static bool parse_options(int argc, char **argv) {
break;
case 'n': /* net name given */
break;
case 'n': /* net name given */
- /* netname "." is special: a "top-level name" */
- netname = strcmp(optarg, ".") != 0 ?
- xstrdup(optarg) : NULL;
+ netname = xstrdup(optarg);
break;
case 'o': /* option */
break;
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;
}