aboutsummaryrefslogtreecommitdiff
path: root/src/bin/pg_test_fsync/pg_test_fsync.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/pg_test_fsync/pg_test_fsync.c')
-rw-r--r--src/bin/pg_test_fsync/pg_test_fsync.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/src/bin/pg_test_fsync/pg_test_fsync.c b/src/bin/pg_test_fsync/pg_test_fsync.c
index ddabf64c583..f7bc199a30a 100644
--- a/src/bin/pg_test_fsync/pg_test_fsync.c
+++ b/src/bin/pg_test_fsync/pg_test_fsync.c
@@ -47,10 +47,7 @@ do { \
alarm_triggered = false; \
if (CreateThread(NULL, 0, process_alarm, NULL, 0, NULL) == \
INVALID_HANDLE_VALUE) \
- { \
- pg_log_error("could not create thread for alarm"); \
- exit(1); \
- } \
+ pg_fatal("could not create thread for alarm"); \
gettimeofday(&start_t, NULL); \
} while (0)
#endif
@@ -95,7 +92,7 @@ static int pg_fsync_writethrough(int fd);
#endif
static void print_elapse(struct timeval start_t, struct timeval stop_t, int ops);
-#define die(msg) do { pg_log_error("%s: %m", _(msg)); exit(1); } while(0)
+#define die(msg) pg_fatal("%s: %m", _(msg))
int
@@ -186,24 +183,20 @@ handle_args(int argc, char *argv[])
errno != 0 || optval != (unsigned int) optval)
{
pg_log_error("invalid argument for option %s", "--secs-per-test");
- fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
+ pg_log_error_hint("Try \"%s --help\" for more information.", progname);
exit(1);
}
secs_per_test = (unsigned int) optval;
if (secs_per_test == 0)
- {
- pg_log_error("%s must be in range %u..%u",
- "--secs-per-test", 1, UINT_MAX);
- exit(1);
- }
+ pg_fatal("%s must be in range %u..%u",
+ "--secs-per-test", 1, UINT_MAX);
break;
default:
- fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
- progname);
+ /* getopt_long already emitted a complaint */
+ pg_log_error_hint("Try \"%s --help\" for more information.", progname);
exit(1);
- break;
}
}
@@ -211,8 +204,7 @@ handle_args(int argc, char *argv[])
{
pg_log_error("too many command-line arguments (first is \"%s\")",
argv[optind]);
- fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
- progname);
+ pg_log_error_hint("Try \"%s --help\" for more information.", progname);
exit(1);
}