From d2210b5edbac23d59c8789c6020f9f850be503c4 Mon Sep 17 00:00:00 2001
From: Stephen Gallagher <sgallagh@redhat.com>
Date: Wed, 28 Oct 2020 15:20:04 -0400
Subject: [PATCH] slog_common_event: Allow --help and --version even on
unsupported platforms
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
---
src/slog_common_event.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/src/slog_common_event.c b/src/slog_common_event.c
index d7409e8fa34e2c95210d18c0939844a4ed091a8b..cc91e7babdbaaff7b2cf51998b4f6dca1b8d04da 100644
--- a/src/slog_common_event.c
+++ b/src/slog_common_event.c
@@ -77,22 +77,10 @@ main(int argc, char **argv) {
char *e=NULL, *s=NULL, *d=NULL, *l=NULL;
char desc[1024];
servicelog *slog;
struct sl_event event;
uint64_t event_id;
-#ifndef SERVICELOG_TEST
- int platform = 0;
-
- platform = get_platform();
- switch (platform) {
- case PLATFORM_UNKNOWN:
- case PLATFORM_POWERNV:
- fprintf(stderr, "%s is not supported on the %s platform\n",
- argv[0], __power_platform_name(platform));
- exit(1);
- }
-#endif
for (;;) {
option_index = 0;
rc = getopt_long(argc, argv, "e:t:s:d:l:hvV", long_options,
&option_index);
@@ -137,10 +125,23 @@ main(int argc, char **argv) {
"(%s).\n", PACKAGE_BUGREPORT);
exit(1);
}
}
+#ifndef SERVICELOG_TEST
+ int platform = 0;
+
+ platform = get_platform();
+ switch (platform) {
+ case PLATFORM_UNKNOWN:
+ case PLATFORM_POWERNV:
+ fprintf(stderr, "%s is not supported on the %s platform\n",
+ argv[0], __power_platform_name(platform));
+ exit(1);
+ }
+#endif
+
if (e == NULL) {
if (verbose) {
fprintf(stderr, "The --event command-line argument is "
"required.");
}
--
2.28.0