summaryrefslogtreecommitdiffstats
path: root/src/network/networkctl.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-05-29 04:02:09 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-05-29 06:22:01 +0200
commit4bddccc684e9c30ba825dae5175b710843c41d56 (patch)
tree7bcb090433251dd7e33a497827adedc5506718e0 /src/network/networkctl.c
parentresolvectl: use parse_ifindex_or_ifname() (diff)
downloadsystemd-4bddccc684e9c30ba825dae5175b710843c41d56.tar.xz
systemd-4bddccc684e9c30ba825dae5175b710843c41d56.zip
networkctl: use parse_ifindex_or_ifname()
Diffstat (limited to 'src/network/networkctl.c')
-rw-r--r--src/network/networkctl.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/network/networkctl.c b/src/network/networkctl.c
index 5e3095917f..321fe92f09 100644
--- a/src/network/networkctl.c
+++ b/src/network/networkctl.c
@@ -1089,12 +1089,9 @@ static int link_delete(int argc, char *argv[], void *userdata) {
return log_oom();
for (i = 1; i < argc; i++) {
- r = parse_ifindex(argv[i], &index);
- if (r < 0) {
- index = (int) if_nametoindex(argv[i]);
- if (index <= 0)
- return log_error_errno(r, "Failed to resolve interface %s", argv[i]);
- }
+ r = parse_ifindex_or_ifname(argv[i], &index);
+ if (r < 0)
+ return log_error_errno(r, "Failed to resolve interface %s", argv[i]);
r = set_put(indexes, INT_TO_PTR(index));
if (r < 0)