From 4d06f1f858d0fea01a2cde74d8b831a823776355 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Mon, 10 Jul 2017 15:29:36 +0300 Subject: [PATCH] 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 --- src/interfaces/libpq/fe-connect.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index e548f3f062..5a964bf0b5 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -965,8 +965,8 @@ connectOptions2(PGconn *conn) { conn->status = CONNECTION_BAD; printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("could not match %d host names to %d hostaddrs\n"), - count_comma_separated_elems(conn->pghost), conn->nconnhost); + libpq_gettext("could not match %d host names to %d hostaddrs\n"), + count_comma_separated_elems(conn->pghost), conn->nconnhost); return false; } } @@ -1097,7 +1097,7 @@ connectOptions2(PGconn *conn) char *pwhost = conn->connhost[i].host; if (conn->connhost[i].type == CHT_HOST_ADDRESS && - conn->connhost[i].host != NULL && conn->connhost[i].host != '\0') + conn->connhost[i].host != NULL && conn->connhost[i].host[0] != '\0') pwhost = conn->connhost[i].hostaddr; conn->connhost[i].password = -- 2.40.0