From 2519668306f917724b9a7d418fc72b824e777555 Mon Sep 17 00:00:00 2001 From: Sven Eden Date: Mon, 1 Jun 2026 12:15:48 +0200 Subject: [PATCH] login/elogind.c: add -v/--version to help check, use STR_IN_SET (#356) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit + Update comment to mention -v/--version option in skip‑checks logic + Replace manual streq checks with STR_IN_SET macro for argument checks + Add -v/--version to direct return set. (#356) Bug: #356 Closes: #356 Signed-off-by: Sven Eden --- src/login/elogind.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/login/elogind.c b/src/login/elogind.c index 24311a31e0..9a3bcee7a2 100644 --- a/src/login/elogind.c +++ b/src/login/elogind.c @@ -424,9 +424,9 @@ int elogind_startup(int argc, char *argv[], bool *has_forked) { int i, r; pid_t pid; - /* if elogind was called with -h/--help or --bus-introspect, skip all checks */ + /* if elogind was called with -h/--help, -v/--version or --bus-introspect, skip all checks */ for (i = 1; !daemonize && (i <= argc) && argv[i]; ++i ) { - if (streq("-h", argv[i]) || streq("--help", argv[i]) || startswith(argv[i], "--bus-introspect") ) + if (STR_IN_SET(argv[i], "-h", "--help", "-v", "--version", argv[i]) || startswith(argv[i], "--bus-introspect") ) return 0; }