diff options
author | Tom Lane | 2016-03-14 14:41:29 +0000 |
---|---|---|
committer | Tom Lane | 2016-03-14 14:41:29 +0000 |
commit | bf53d5c208a3bdce243a38666fc50f5418c78c3b (patch) | |
tree | 6a3201118da42e36a127254f883ba45aa889dde6 /configure | |
parent | 9da70efcbe09954b1006f878d39885a4acf1c534 (diff) |
Teach the configure script to validate its --with-pgport argument.
Previously, configure would take any string, including an empty string,
leading to obscure compile failures in guc.c. It seems worth expending
a few lines of code to ensure that the argument is a decimal number
between 1 and 65535.
Report and patch by Jim Nasby; reviews by Alex Shulgin, Peter Eisentraut,
Ivan Kartyshov
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/configure b/configure index 0e51ac70ed9..08cff2357e3 100755 --- a/configure +++ b/configure @@ -3100,6 +3100,17 @@ _ACEOF +# It's worth validating port; you can get very confusing errors otherwise +if test x"$default_port" = x""; then + as_fn_error $? "invalid --with-pgport specification: empty string" "$LINENO" 5 +elif test ! x`echo "$default_port" | sed -e 's/[0-9]*//'` = x""; then + as_fn_error $? "invalid --with-pgport specification: must be a number" "$LINENO" 5 +elif test ! x`echo "$default_port" | sed -e 's/^0.//'` = x"$default_port"; then + as_fn_error $? "invalid --with-pgport specification: must not have leading 0" "$LINENO" 5 +elif test "$default_port" -lt "1" -o "$default_port" -gt "65535"; then + as_fn_error $? "invalid --with-pgport specification: must be between 1 and 65535" "$LINENO" 5 +fi + # # '-rpath'-like feature can be disabled # |