Skip to content

Commit 496d566

Browse files
committed
initdb: Improve --wal-segsize handling
Give separate error messages for when the argument is not a number and when it is not the right kind of number. Fix wording in the help message.
1 parent 4644a11 commit 496d566

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/bin/initdb/initdb.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2323,7 +2323,7 @@ usage(const char *progname)
23232323
printf(_(" -U, --username=NAME database superuser name\n"));
23242324
printf(_(" -W, --pwprompt prompt for a password for the new superuser\n"));
23252325
printf(_(" -X, --waldir=WALDIR location for the write-ahead log directory\n"));
2326-
printf(_(" --wal-segsize=SIZE size of wal segment size in megabytes\n"));
2326+
printf(_(" --wal-segsize=SIZE size of WAL segments, in megabytes\n"));
23272327
printf(_("\nLess commonly used options:\n"));
23282328
printf(_(" -d, --debug generate lots of debugging output\n"));
23292329
printf(_(" -k, --data-checksums use data page checksums\n"));
@@ -3224,11 +3224,17 @@ main(int argc, char *argv[])
32243224
wal_segment_size_mb = strtol(str_wal_segment_size_mb, &endptr, 10);
32253225

32263226
/* verify that wal segment size is valid */
3227-
if (*endptr != '\0' ||
3228-
!IsValidWalSegSize(wal_segment_size_mb * 1024 * 1024))
3227+
if (*endptr != '\0')
32293228
{
32303229
fprintf(stderr,
3231-
_("%s: --wal-segsize must be a power of two between 1 and 1024\n"),
3230+
_("%s: argument of --wal-segsize must be a number\n"),
3231+
progname);
3232+
exit(1);
3233+
}
3234+
if (!IsValidWalSegSize(wal_segment_size_mb * 1024 * 1024))
3235+
{
3236+
fprintf(stderr,
3237+
_("%s: argument of --wal-segsize must be a power of two between 1 and 1024\n"),
32323238
progname);
32333239
exit(1);
32343240
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy