summaryrefslogtreecommitdiffstats
path: root/src/udev/udevadm.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/udev/udevadm.c
parentnetwork: fix typo (diff)
downloadsystemd-2306d1778f2479cb16423d51d82f8f31b15146d1.tar.xz
systemd-2306d1778f2479cb16423d51d82f8f31b15146d1.zip
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/udev/udevadm.c')
-rw-r--r--src/udev/udevadm.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/udev/udevadm.c b/src/udev/udevadm.c
index 47d1a2fb9c..e55ae4bd54 100644
--- a/src/udev/udevadm.c
+++ b/src/udev/udevadm.c
@@ -8,13 +8,14 @@
#include "alloc-util.h"
#include "main-func.h"
#include "pretty-print.h"
+#include "process-util.h"
#include "selinux-util.h"
#include "string-util.h"
+#include "udev-util.h"
#include "udevadm.h"
#include "udevd.h"
-#include "udev-util.h"
-#include "verbs.h"
#include "util.h"
+#include "verbs.h"
static int help(void) {
static const char *const short_descriptions[][2] = {
@@ -111,7 +112,7 @@ static int udevadm_main(int argc, char *argv[]) {
static int run(int argc, char *argv[]) {
int r;
- if (strstr(program_invocation_short_name, "udevd"))
+ if (invoked_as(argv, "udevd"))
return run_udevd(argc, argv);
udev_parse_config();