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

Commit65f431a

Browse files
committed
Parse libpq's "keepalives" option more like other integer options.
Use pqParseIntParam (nee parse_int_param) instead of using strtoldirectly. This allows trailing whitespace, which the previous codingdidn't, and makes the spelling of the error message consistent withother similar cases.This seems to be an oversight in commite7a2217, which introducedparse_int_param. That fixed places that were using atoi(), but missedthis place which was randomly using strtol() instead.Ordinarily I'd consider this minor cleanup not worth back-patching.However, it seems that ecpg assumes it can add trailing whitespaceto URL parameters, so that use of the keepalives option fails inthat context. Perhaps that's worth improving as a separate matter.In the meantime, back-patch this to all supported branches.Yuto Sasaki (some further cleanup by me)Discussion:https://postgr.es/m/TY2PR01MB36286A7B97B9A15793335D18C1772@TY2PR01MB3628.jpnprd01.prod.outlook.com
1 parente4859f8 commit65f431a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎src/interfaces/libpq/fe-connect.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2067,14 +2067,14 @@ connectFailureMessage(PGconn *conn, int errorno)
20672067
staticint
20682068
useKeepalives(PGconn*conn)
20692069
{
2070-
char*ep;
20712070
intval;
20722071

20732072
if (conn->keepalives==NULL)
20742073
return1;
2075-
val=strtol(conn->keepalives,&ep,10);
2076-
if (*ep)
2074+
2075+
if (!parse_int_param(conn->keepalives,&val,conn,"keepalives"))
20772076
return-1;
2077+
20782078
returnval!=0 ?1 :0;
20792079
}
20802080

@@ -2958,7 +2958,7 @@ PQconnectPoll(PGconn *conn)
29582958

29592959
if (usekeepalives<0)
29602960
{
2961-
libpq_append_conn_error(conn,"keepalives parameter must be an integer");
2961+
/* error is already reported */
29622962
err=1;
29632963
}
29642964
elseif (usekeepalives==0)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp