Fix heartbeat_device treatment.
authorTatsuo Ishii <ishii@postgresql.org>
Mon, 9 Jun 2025 03:49:36 +0000 (12:49 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Mon, 9 Jun 2025 03:49:36 +0000 (12:49 +0900)
While processing pgpool.conf, heartbeat_device was mistakenly treated
and the first device was ignored. For example:

heartbeat_device0 = 'eth0'

the configuration process disregarded 'eth0' and acted as if no device
was set. Another example:

heartbeat_device0 = 'eth0;eth1'

"eth0" was simply ignored.

Reviewed-by: Bo Peng <pengbo@sraoss.co.jp>
Backpatch-through: v4.2

src/config/pool_config_variables.c

index 4fa0396642127a10c647af9aee95c7383d217a89..5e61f02db4cf715ae239a3b2d27b2ca58067d17f 100644 (file)
@@ -5373,7 +5373,7 @@ SetHBDestIfFunc(int elevel)
                        {
                                strlcpy(g_pool_config.hb_dest_if[idx].addr, addrs[j], WD_MAX_HOST_NAMELEN - 1);
                                g_pool_config.hb_dest_if[idx].dest_port = hbNodeInfo->dest_port;
-                               if (n_if_name > j + 1)
+                               if (n_if_name > j )
                                {
                                        strlcpy(g_pool_config.hb_dest_if[idx].if_name, if_names[j], WD_MAX_IF_NAME_LEN - 1);
                                        pfree(if_names[j]);