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

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