diff options
Diffstat (limited to 'src/fe_utils/option_utils.c')
-rw-r--r-- | src/fe_utils/option_utils.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/fe_utils/option_utils.c b/src/fe_utils/option_utils.c index 3e7e512ad91..bcfe7365fd3 100644 --- a/src/fe_utils/option_utils.c +++ b/src/fe_utils/option_utils.c @@ -57,7 +57,14 @@ option_parse_int(const char *optarg, const char *optname, errno = 0; val = strtoint(optarg, &endptr, 10); - if (*endptr) + /* + * Skip any trailing whitespace; if anything but whitespace remains before + * the terminating character, fail. + */ + while (*endptr != '\0' && isspace((unsigned char) *endptr)) + endptr++; + + if (*endptr != '\0') { pg_log_error("invalid value \"%s\" for option %s", optarg, optname); |