Hello,

> I noticed that exit_hook_registered variable in start_postmaster() is
> local variable. Shouldn't it be a static variable?
> 
> I attached a patch. Thank you!

Good catch! It is totally useless unless being static.

But I think it is not necessary to go outside
start_postmaster. Just being static staying in start_postmaster
is enough.

regards,

-- 
Kyotaro Horiguchi
NTT Open Source Software Center
>From 21695d427b146a0a44297558c747bb75e48c62dd Mon Sep 17 00:00:00 2001
From: Kyotaro Horiguchi <horiguchi.kyot...@lab.ntt.co.jp>
Date: Thu, 28 Jul 2016 19:13:46 +0900
Subject: [PATCH] start_postmaster of pg_upgarde registers exit function more
 than once.

start_postmaster of pg_upgrade is intending to register an exit
function but it fails to prevent duplicate regstration by defining
control variable as function-local. It should be static.
---
 src/bin/pg_upgrade/server.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/pg_upgrade/server.c b/src/bin/pg_upgrade/server.c
index 969e5d6..3fe169d 100644
--- a/src/bin/pg_upgrade/server.c
+++ b/src/bin/pg_upgrade/server.c
@@ -174,7 +174,7 @@ start_postmaster(ClusterInfo *cluster, bool throw_error)
 {
 	char		cmd[MAXPGPATH * 4 + 1000];
 	PGconn	   *conn;
-	bool		exit_hook_registered = false;
+	static bool	exit_hook_registered = false;
 	bool		pg_ctl_return = false;
 	char		socket_string[MAXPGPATH + 200];
 
-- 
1.8.3.1

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to