pgpool2.git / summary / log / commit / refs

commit    d2b64fa2d81c1151cfda1235874dfd548382efb5
Author:   Tatsuo Ishii <ishii@postgresql.org>
Date:     Wed Nov 15 23:12:13 2017 +0000

    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 cb3bac54e..1b4da1e50 100644 --- a/src/main/pgpool_main.c +++ b/src/main/pgpool_main.c @@ -215,7 +215,11 @@ int PgpoolMain(bool discard_status, bool clear_memcache_oidmaps) 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); [parent: 68855bc9546a]