diff options
author | Tomas Vondra | 2018-10-12 12:32:54 +0000 |
---|---|---|
committer | Tomas Vondra | 2018-10-12 12:54:50 +0000 |
commit | a74d237c3147ee1b60c91fa5d399399926a5de4a (patch) | |
tree | 90d395f1143ce0e8c1743ffcbcf29be3ad6fe168 | |
parent | fe96e7a90ee99ceae6036eba7e8a9f9427d5cdec (diff) |
Fix incorrect comparison in pgxcnode_gethash
The check is supposed to ensure NULL/empty nodename gets hashed to 0,
but (nodename == '\0') is comparing the pointer itself, not the first
character. So dereference that correctly.
-rw-r--r-- | src/gtm/recovery/register_common.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gtm/recovery/register_common.c b/src/gtm/recovery/register_common.c index cda2d4041f..24c4d9b159 100644 --- a/src/gtm/recovery/register_common.c +++ b/src/gtm/recovery/register_common.c @@ -171,7 +171,7 @@ pgxcnode_find_info(GTM_PGXCNodeType type, char *node_name) /* * Get the Hash Key depending on the node name - * We do not except to have hundreds of nodes yet, + * We do not expect to have hundreds of nodes yet, * This function could be replaced by a better one * such as a double hash function indexed on type and Node Name */ @@ -183,7 +183,7 @@ pgxcnode_gethash(char *nodename) int value; uint32 hash = 0; - if (nodename == NULL || nodename == '\0') + if (nodename == NULL || *nodename == '\0') { return 0; } |