summaryrefslogtreecommitdiff
path: root/src/resolve/resolvectl.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-02-19 20:36:45 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-02-20 14:45:27 +0100
commit2306d1778f2479cb16423d51d82f8f31b15146d1 (patch)
treee8a2f3b310155f1c5a25378a26c58ab1198e4e28 /src/resolve/resolvectl.c
parent27edd36eaa0ff6478f7885a702567841fef2f186 (diff)
downloadsystemd-2306d1778f2479cb16423d51d82f8f31b15146d1.tar.gz
systemctl: don't search in the full argv[0] for the invocation name
argv[0] might be prefixed by a path, and we shouldn't get confused by that. Hence provide a simple helper call that abstracts the checking away, which we can use everywhere, and expose the same behaviour, even if argv[0] is not set. (While we are at it, port all other multi-call binaries over to the new helper, too) Follow-up for: d41a9e4fc1e1bcdefc8d358da2744a97aac5820a
Diffstat (limited to 'src/resolve/resolvectl.c')
-rw-r--r--src/resolve/resolvectl.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/resolve/resolvectl.c b/src/resolve/resolvectl.c
index b645147fd8..2bd18d2c6d 100644
--- a/src/resolve/resolvectl.c
+++ b/src/resolve/resolvectl.c
@@ -26,6 +26,7 @@
#include "parse-argument.h"
#include "parse-util.h"
#include "pretty-print.h"
+#include "process-util.h"
#include "resolvconf-compat.h"
#include "resolvectl.h"
#include "resolved-def.h"
@@ -3394,9 +3395,9 @@ static int run(int argc, char **argv) {
setlocale(LC_ALL, "");
log_setup();
- if (streq(program_invocation_short_name, "resolvconf"))
+ if (invoked_as(argv, "resolvconf"))
r = resolvconf_parse_argv(argc, argv);
- else if (streq(program_invocation_short_name, "systemd-resolve"))
+ else if (invoked_as(argv, "systemd-resolve"))
r = compat_parse_argv(argc, argv);
else
r = native_parse_argv(argc, argv);