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

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