From 1cc1df104888bd4fd2c9c86aa6846543c78609be Mon Sep 17 00:00:00 2001
From: Tomas Vondra <tomas@2ndquadrant.com>
Date: Fri, 12 Oct 2018 14:32:54 +0200
Subject: [PATCH] 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.
---
 src/gtm/recovery/register_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gtm/recovery/register_common.c b/src/gtm/recovery/register_common.c
index ff0f960e33..e0afe1425f 100644
--- a/src/gtm/recovery/register_common.c
+++ b/src/gtm/recovery/register_common.c
@@ -174,7 +174,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
  */
@@ -186,7 +186,7 @@ pgxcnode_gethash(char *nodename)
 	int			value;
 	uint32			hash = 0;
 
-	if (nodename == NULL || nodename == '\0')
+	if (nodename == NULL || *nodename == '\0')
 	{
 		return 0;
 	}
-- 
2.39.5

