mirror of
https://github.com/postgres/postgres.git
synced 2025-04-21 12:05:57 +03:00
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
This commit is contained in:
parent
9da70efcbe
commit
bf53d5c208
11
configure
vendored
11
configure
vendored
@ -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
|
# '-rpath'-like feature can be disabled
|
||||||
#
|
#
|
||||||
|
11
configure.in
11
configure.in
@ -165,6 +165,17 @@ AC_DEFINE_UNQUOTED(DEF_PGPORT_STR, "${default_port}",
|
|||||||
[Define to the default TCP port number as a string constant.])
|
[Define to the default TCP port number as a string constant.])
|
||||||
AC_SUBST(default_port)
|
AC_SUBST(default_port)
|
||||||
|
|
||||||
|
# It's worth validating port; you can get very confusing errors otherwise
|
||||||
|
if test x"$default_port" = x""; then
|
||||||
|
AC_MSG_ERROR([invalid --with-pgport specification: empty string])
|
||||||
|
elif test ! x`echo "$default_port" | sed -e 's/[[0-9]]*//'` = x""; then
|
||||||
|
AC_MSG_ERROR([invalid --with-pgport specification: must be a number])
|
||||||
|
elif test ! x`echo "$default_port" | sed -e 's/^0.//'` = x"$default_port"; then
|
||||||
|
AC_MSG_ERROR([invalid --with-pgport specification: must not have leading 0])
|
||||||
|
elif test "$default_port" -lt "1" -o "$default_port" -gt "65535"; then
|
||||||
|
AC_MSG_ERROR([invalid --with-pgport specification: must be between 1 and 65535])
|
||||||
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# '-rpath'-like feature can be disabled
|
# '-rpath'-like feature can be disabled
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user