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