Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4d06f1f

Browse files
committed
Fix check for empty hostname.
As reported by Arthur Zakirov, Gcc 7.1 complained about this with -Wpointer-compare. Discussion: https://www.postgresql.org/message-id/CAKNkYnybV_NFVacGbW=VspzAo3TwRJFNi+9iBob66YqQMZopwg@mail.gmail.com
1 parent 1add0b1 commit 4d06f1f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/interfaces/libpq/fe-connect.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -965,8 +965,8 @@ connectOptions2(PGconn *conn)
965965
{
966966
conn->status = CONNECTION_BAD;
967967
printfPQExpBuffer(&conn->errorMessage,
968-
libpq_gettext("could not match %d host names to %d hostaddrs\n"),
969-
count_comma_separated_elems(conn->pghost), conn->nconnhost);
968+
libpq_gettext("could not match %d host names to %d hostaddrs\n"),
969+
count_comma_separated_elems(conn->pghost), conn->nconnhost);
970970
return false;
971971
}
972972
}
@@ -1097,7 +1097,7 @@ connectOptions2(PGconn *conn)
10971097
char *pwhost = conn->connhost[i].host;
10981098

10991099
if (conn->connhost[i].type == CHT_HOST_ADDRESS &&
1100-
conn->connhost[i].host != NULL && conn->connhost[i].host != '\0')
1100+
conn->connhost[i].host != NULL && conn->connhost[i].host[0] != '\0')
11011101
pwhost = conn->connhost[i].hostaddr;
11021102

11031103
conn->connhost[i].password =

0 commit comments

Comments
 (0)