diff options
author | Filipe Brandenburger <filbranden@google.com> | 2018-06-25 18:07:48 -0700 |
---|---|---|
committer | Filipe Brandenburger <filbranden@google.com> | 2018-06-26 23:09:36 -0700 |
commit | 5a01b3f35d7b6182c78b6973db8d99bdabd4f9c3 (patch) | |
tree | 9bb7b3ecb48cee06021230ae10599a92779c77e2 /src/resolve/resolvconf-compat.c | |
parent | ad4bc3352285f467f4ffa03c3171b19fa0a8758d (diff) | |
download | systemd-5a01b3f35d7b6182c78b6973db8d99bdabd4f9c3.tar.gz |
resolvconf: fixes for the compatibility interface
Also use compat_main() when called as `resolvconf`, since the interface
is closer to that of `systemd-resolve`.
Use a heap allocated string to set arg_ifname, since a stack allocated
one would be lost after the function returns. (This last one broke the
case where an interface name was suffixed with a dot, such as in
`resolvconf -a tap0.dhcp`.)
Tested:
$ build/resolvconf -a nonexistent.abc </etc/resolv.conf
Unknown interface 'nonexistent': No such device
Fixes #9423.
Diffstat (limited to 'src/resolve/resolvconf-compat.c')
-rw-r--r-- | src/resolve/resolvconf-compat.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/resolve/resolvconf-compat.c b/src/resolve/resolvconf-compat.c index d7e68003e6..0723458945 100644 --- a/src/resolve/resolvconf-compat.c +++ b/src/resolve/resolvconf-compat.c @@ -53,6 +53,8 @@ static int parse_nameserver(const char *string) { if (strv_push(&arg_set_dns, word) < 0) return log_oom(); + + word = NULL; } return 0; @@ -202,7 +204,7 @@ int resolvconf_parse_argv(int argc, char *argv[]) { dot = strchr(argv[optind], '.'); if (dot) { - iface = strndupa(argv[optind], dot - argv[optind]); + iface = strndup(argv[optind], dot - argv[optind]); log_debug("Ignoring protocol specifier '%s'.", dot + 1); } else iface = argv[optind]; |