Blame SOURCES/bz2109159-storage_mon-1-exit-after-help.patch

ff491c
From b3eadb8523b599af800a7c772606aa0e90cf142f Mon Sep 17 00:00:00 2001
ff491c
From: Fujii Masao <fujii@postgresql.org>
ff491c
Date: Tue, 19 Jul 2022 17:03:02 +0900
ff491c
Subject: [PATCH 1/2] Make storage_mon -h exit just after printing help
ff491c
 messages.
ff491c
ff491c
Previously, when -h or an invalid option was specified, storage_mon
ff491c
printed the help messages, proceeded processing and then could
ff491c
throw an error. This was not the behavior that, e.g., users who want
ff491c
to specify -h option to see the help messages are expecting. To fix
ff491c
this issue, this commit changes storage_mon so that it exits just
ff491c
after printing the help messages when -h or an invalid option is
ff491c
specified.
ff491c
---
ff491c
 tools/storage_mon.c | 4 +++-
ff491c
 1 file changed, 3 insertions(+), 1 deletion(-)
ff491c
ff491c
diff --git a/tools/storage_mon.c b/tools/storage_mon.c
ff491c
index 7b65bb419..1303371f7 100644
ff491c
--- a/tools/storage_mon.c
ff491c
+++ b/tools/storage_mon.c
ff491c
@@ -28,7 +28,7 @@ static void usage(char *name, FILE *f)
ff491c
 	fprintf(f, "      --timeout <n>   max time to wait for a device test to come back. in seconds (default %d)\n", DEFAULT_TIMEOUT);
ff491c
 	fprintf(f, "      --inject-errors-percent <n> Generate EIO errors <n>%% of the time (for testing only)\n");
ff491c
 	fprintf(f, "      --verbose        emit extra output to stdout\n");
ff491c
-	fprintf(f, "      --help           print this messages\n");
ff491c
+	fprintf(f, "      --help           print this messages, then exit\n");
ff491c
 }
ff491c
 
ff491c
 /* Check one device */
ff491c
@@ -178,9 +178,11 @@ int main(int argc, char *argv[])
ff491c
 				break;
ff491c
 			case 'h':
ff491c
 				usage(argv[0], stdout);
ff491c
+				exit(0);
ff491c
 				break;
ff491c
 			default:
ff491c
 				usage(argv[0], stderr);
ff491c
+				exit(-1);
ff491c
 				break;
ff491c
 		}
ff491c
 
ff491c
ff491c
From e62795f02d25a772a239e0a4f9eb9d6470c134ee Mon Sep 17 00:00:00 2001
ff491c
From: Fujii Masao <fujii@postgresql.org>
ff491c
Date: Tue, 19 Jul 2022 17:56:32 +0900
ff491c
Subject: [PATCH 2/2] Fix typo in help message.
ff491c
ff491c
---
ff491c
 tools/storage_mon.c | 6 +++---
ff491c
 1 file changed, 3 insertions(+), 3 deletions(-)
ff491c
ff491c
diff --git a/tools/storage_mon.c b/tools/storage_mon.c
ff491c
index 1303371f7..3c82d5ee8 100644
ff491c
--- a/tools/storage_mon.c
ff491c
+++ b/tools/storage_mon.c
ff491c
@@ -28,7 +28,7 @@ static void usage(char *name, FILE *f)
ff491c
 	fprintf(f, "      --timeout <n>   max time to wait for a device test to come back. in seconds (default %d)\n", DEFAULT_TIMEOUT);
ff491c
 	fprintf(f, "      --inject-errors-percent <n> Generate EIO errors <n>%% of the time (for testing only)\n");
ff491c
 	fprintf(f, "      --verbose        emit extra output to stdout\n");
ff491c
-	fprintf(f, "      --help           print this messages, then exit\n");
ff491c
+	fprintf(f, "      --help           print this message\n");
ff491c
 }
ff491c
 
ff491c
 /* Check one device */
ff491c
@@ -178,11 +178,11 @@ int main(int argc, char *argv[])
ff491c
 				break;
ff491c
 			case 'h':
ff491c
 				usage(argv[0], stdout);
ff491c
-				exit(0);
ff491c
+				return 0;
ff491c
 				break;
ff491c
 			default:
ff491c
 				usage(argv[0], stderr);
ff491c
-				exit(-1);
ff491c
+				return -1;
ff491c
 				break;
ff491c
 		}
ff491c