Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbf53d5c

Browse files
committed
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 expendinga few lines of code to ensure that the argument is a decimal numberbetween 1 and 65535.Report and patch by Jim Nasby; reviews by Alex Shulgin, Peter Eisentraut,Ivan Kartyshov
1 parent9da70ef commitbf53d5c

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

‎configure

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3100,6 +3100,17 @@ _ACEOF
31003100

31013101

31023102

3103+
# It's worth validating port; you can get very confusing errors otherwise
3104+
iftest x"$default_port" = x"";then
3105+
as_fn_error$?"invalid --with-pgport specification: empty string""$LINENO" 5
3106+
eliftest! x`echo"$default_port"| sed -e's/[0-9]*//'` = x"";then
3107+
as_fn_error$?"invalid --with-pgport specification: must be a number""$LINENO" 5
3108+
eliftest! x`echo"$default_port"| sed -e's/^0.//'` = x"$default_port";then
3109+
as_fn_error$?"invalid --with-pgport specification: must not have leading 0""$LINENO" 5
3110+
eliftest"$default_port" -lt"1" -o"$default_port" -gt"65535";then
3111+
as_fn_error$?"invalid --with-pgport specification: must be between 1 and 65535""$LINENO" 5
3112+
fi
3113+
31033114
#
31043115
# '-rpath'-like feature can be disabled
31053116
#

‎configure.in

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,17 @@ AC_DEFINE_UNQUOTED(DEF_PGPORT_STR, "${default_port}",
165165
[Define to the default TCP port number as a string constant.])
166166
AC_SUBST(default_port)
167167

168+
# It's worth validating port; you can get very confusing errors otherwise
169+
if test x"$default_port" = x""; then
170+
AC_MSG_ERROR([invalid --with-pgport specification: empty string])
171+
elif test ! x`echo "$default_port" | sed -e 's/[[0-9]]*//'` = x""; then
172+
AC_MSG_ERROR([invalid --with-pgport specification: must be a number])
173+
elif test ! x`echo "$default_port" | sed -e 's/^0.//'` = x"$default_port"; then
174+
AC_MSG_ERROR([invalid --with-pgport specification: must not have leading 0])
175+
elif test "$default_port" -lt "1" -o "$default_port" -gt "65535"; then
176+
AC_MSG_ERROR([invalid --with-pgport specification: must be between 1 and 65535])
177+
fi
178+
168179
#
169180
# '-rpath'-like feature can be disabled
170181
#

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp