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

Commit920d519

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 parentd94cf5c commit920d519

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
@@ -2169,14 +2169,14 @@ connectFailureMessage(PGconn *conn, int errorno)
21692169
staticint
21702170
useKeepalives(PGconn*conn)
21712171
{
2172-
char*ep;
21732172
intval;
21742173

21752174
if (conn->keepalives==NULL)
21762175
return1;
2177-
val=strtol(conn->keepalives,&ep,10);
2178-
if (*ep)
2176+
2177+
if (!pqParseIntParam(conn->keepalives,&val,conn,"keepalives"))
21792178
return-1;
2179+
21802180
returnval!=0 ?1 :0;
21812181
}
21822182

@@ -3084,7 +3084,7 @@ PQconnectPoll(PGconn *conn)
30843084

30853085
if (usekeepalives<0)
30863086
{
3087-
libpq_append_conn_error(conn,"keepalives parameter must be an integer");
3087+
/* error is already reported */
30883088
err=1;
30893089
}
30903090
elseif (usekeepalives==0)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp