summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-09-21 10:45:26 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-09-21 10:58:54 +0200
commit51b006e18de49c91a26fae232ec1bc12e26942ea (patch)
treee8de3d9f007cba3ac416d2c094638456c1832167
parentMerge pull request #10135 from yuwata/log-skipped-tests (diff)
downloadsystemd-51b006e18de49c91a26fae232ec1bc12e26942ea.tar.xz
systemd-51b006e18de49c91a26fae232ec1bc12e26942ea.zip
udevadm: show only version number for '--version' option
This effectively reverts 2bc54be485def3d1697a00209ff73ae21aa7f268 and relevant changes in #9920, as it is used to determine the version of udev, e.g., dracut. Fixes dracutdevs/dracut#468.
-rw-r--r--src/udev/udevadm-control.c2
-rw-r--r--src/udev/udevadm-hwdb.c2
-rw-r--r--src/udev/udevadm-info.c2
-rw-r--r--src/udev/udevadm-monitor.c2
-rw-r--r--src/udev/udevadm-settle.c2
-rw-r--r--src/udev/udevadm-test-builtin.c2
-rw-r--r--src/udev/udevadm-test.c2
-rw-r--r--src/udev/udevadm-trigger.c2
-rw-r--r--src/udev/udevadm.c4
-rw-r--r--src/udev/udevadm.h7
10 files changed, 17 insertions, 10 deletions
diff --git a/src/udev/udevadm-control.c b/src/udev/udevadm-control.c
index 68c6b8104c..3125a18088 100644
--- a/src/udev/udevadm-control.c
+++ b/src/udev/udevadm-control.c
@@ -144,7 +144,7 @@ int control_main(int argc, char *argv[], void *userdata) {
break;
}
case 'V':
- return version();
+ return print_version();
case 'h':
return help();
case '?':
diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c
index e1a322e545..4eb2897b21 100644
--- a/src/udev/udevadm-hwdb.c
+++ b/src/udev/udevadm-hwdb.c
@@ -65,7 +65,7 @@ static int parse_argv(int argc, char *argv[]) {
arg_root = optarg;
break;
case 'V':
- return version();
+ return print_version();
case 'h':
return help();
case '?':
diff --git a/src/udev/udevadm-info.c b/src/udev/udevadm-info.c
index 23a27d0a28..92c7cfe6bf 100644
--- a/src/udev/udevadm-info.c
+++ b/src/udev/udevadm-info.c
@@ -357,7 +357,7 @@ int info_main(int argc, char *argv[], void *userdata) {
export_prefix = optarg;
break;
case 'V':
- return version();
+ return print_version();
case 'h':
return help();
case '?':
diff --git a/src/udev/udevadm-monitor.c b/src/udev/udevadm-monitor.c
index ba6f30f17f..8a0db2b89d 100644
--- a/src/udev/udevadm-monitor.c
+++ b/src/udev/udevadm-monitor.c
@@ -205,7 +205,7 @@ static int parse_argv(int argc, char *argv[]) {
break;
}
case 'V':
- return version();
+ return print_version();
case 'h':
return help();
case '?':
diff --git a/src/udev/udevadm-settle.c b/src/udev/udevadm-settle.c
index a172b25ada..7e02275ba4 100644
--- a/src/udev/udevadm-settle.c
+++ b/src/udev/udevadm-settle.c
@@ -57,7 +57,7 @@ static int parse_argv(int argc, char *argv[]) {
arg_exists = optarg;
break;
case 'V':
- return version();
+ return print_version();
case 'h':
return help();
case 's':
diff --git a/src/udev/udevadm-test-builtin.c b/src/udev/udevadm-test-builtin.c
index ac1a8c2d7d..940d691dd7 100644
--- a/src/udev/udevadm-test-builtin.c
+++ b/src/udev/udevadm-test-builtin.c
@@ -40,7 +40,7 @@ static int parse_argv(int argc, char *argv[]) {
while ((c = getopt_long(argc, argv, "Vh", options, NULL)) >= 0)
switch (c) {
case 'V':
- return version();
+ return print_version();
case 'h':
return help();
case '?':
diff --git a/src/udev/udevadm-test.c b/src/udev/udevadm-test.c
index 65e14a8664..462c5818f4 100644
--- a/src/udev/udevadm-test.c
+++ b/src/udev/udevadm-test.c
@@ -62,7 +62,7 @@ static int parse_argv(int argc, char *argv[]) {
}
break;
case 'V':
- return version();
+ return print_version();
case 'h':
return help();
case '?':
diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c
index 84a977e094..e08d342f29 100644
--- a/src/udev/udevadm-trigger.c
+++ b/src/udev/udevadm-trigger.c
@@ -232,7 +232,7 @@ int trigger_main(int argc, char *argv[], void *userdata) {
}
case 'V':
- return version();
+ return print_version();
case 'h':
return help();
case '?':
diff --git a/src/udev/udevadm.c b/src/udev/udevadm.c
index 7c6eb3bf4c..64092c5500 100644
--- a/src/udev/udevadm.c
+++ b/src/udev/udevadm.c
@@ -68,7 +68,7 @@ static int parse_argv(int argc, char *argv[]) {
return help();
case 'V':
- return version();
+ return print_version();
case '?':
return -EINVAL;
@@ -81,7 +81,7 @@ static int parse_argv(int argc, char *argv[]) {
}
static int version_main(int argc, char *argv[], void *userdata) {
- return version();
+ return print_version();
}
static int help_main(int argc, char *argv[], void *userdata) {
diff --git a/src/udev/udevadm.h b/src/udev/udevadm.h
index 7c20e0a8ff..98f9019a48 100644
--- a/src/udev/udevadm.h
+++ b/src/udev/udevadm.h
@@ -1,6 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0+ */
#pragma once
+#include <stdio.h>
+
int info_main(int argc, char *argv[], void *userdata);
int trigger_main(int argc, char *argv[], void *userdata);
int settle_main(int argc, char *argv[], void *userdata);
@@ -9,3 +11,8 @@ int monitor_main(int argc, char *argv[], void *userdata);
int hwdb_main(int argc, char *argv[], void *userdata);
int test_main(int argc, char *argv[], void *userdata);
int builtin_main(int argc, char *argv[], void *userdata);
+
+static inline int print_version(void) {
+ puts(PACKAGE_VERSION);
+ return 0;
+}