Blame 0001-slog_common_event-Allow-help-and-version-even-on-uns.patch

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