From 9e21ef9306dfda9a8df306f7a79b80c7ff046c7b Mon Sep 17 00:00:00 2001 From: Tatsuo Ishii Date: Thu, 16 Nov 2017 08:12:13 +0900 Subject: [PATCH] Fix pgpool start message printed multiple times. When an exception occurs in the main loop, longjmp() gets called and the variable "first" restored to the initial value. This make the pgpool start message printed multiple times. This is harmless but confusing. To fix that, add "volatile" qualifier so that the variable is on the stack, rather than on a register. Fix suggested by Muhammad Usama. --- src/main/pgpool_main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/pgpool_main.c b/src/main/pgpool_main.c index 1070c3c86..9ee39fa0e 100644 --- a/src/main/pgpool_main.c +++ b/src/main/pgpool_main.c @@ -193,7 +193,11 @@ int PgpoolMain(bool discard_status, bool clear_memcache_oidmaps) MemoryContext MainLoopMemoryContext; sigjmp_buf local_sigjmp_buf; - bool first = true; + /* + * to prevent the variable set on a register so that longjmp() does not + * discard the content + */ + volatile bool first = true; /* For PostmasterRandom */ gettimeofday(&random_start_time, NULL); -- 2.39.5