pgpool2.git / summary / log / commit / refs

commit    c7cfb0226d47b914fea5ab465fa67a8d3a95d2ef
Author:   Tatsuo Ishii <ishii@sraoss.co.jp>
Date:     Sat Mar 30 12:29:41 2019 +0000

    Suppress compiler warnings.
    
    Suppress compiler warnings regarding write(2) returns values being
    ignored.  Since they are used in signal handlers, it's impossible to
    print info about errors. To shut up the warnings, create a static
    variable and assign the return values from write().


src/main/pgpool_main.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/pgpool_main.c b/src/main/pgpool_main.c index 22ed3f764..6695ebd7e 100644 --- a/src/main/pgpool_main.c +++ b/src/main/pgpool_main.c @@ -212,6 +212,12 @@ static pid_t wd_lifecheck_pid = 0; /* pid for child process handling watchdog BACKEND_STATUS *my_backend_status[MAX_NUM_BACKENDS]; /* Backend status buffer */ int my_master_node_id; /* Master node id buffer */ +/* + * Dummy varibale to suppress compiler warnings by discarding return values + * from write(2) in signal handlers + */ +static int dummy_status; + /* * pgpool main program */ @@ -1509,7 +1515,7 @@ static RETSIGTYPE sigusr1_handler(int sig) POOL_SETMASK(&BlockSig); sigusr1_request = 1; - write(pipe_fds[1], "\0", 1); + dummy_status = write(pipe_fds[1], "\0", 1); #ifdef NOT_USED if (write(pipe_fds[1], "\0", 1) < 0) @@ -2475,7 +2481,7 @@ static RETSIGTYPE reap_handler(int sig) if (pipe_fds[1]) { - write(pipe_fds[1], "\0", 1); + dummy_status = write(pipe_fds[1], "\0", 1); } #ifdef NOT_USED @@ -2812,7 +2818,7 @@ static RETSIGTYPE wakeup_handler(int sig) if (processState != INITIALIZING) { POOL_SETMASK(&BlockSig); - write(pipe_fds[1], "\0", 1); + dummy_status = write(pipe_fds[1], "\0", 1); #ifdef NOT_USED if (write(pipe_fds[1], "\0", 1) < 0) ereport(WARNING, @@ -2833,7 +2839,7 @@ static RETSIGTYPE reload_config_handler(int sig) POOL_SETMASK(&BlockSig); reload_config_request = 1; - write(pipe_fds[1], "\0", 1); + dummy_status = write(pipe_fds[1], "\0", 1); #ifdef NOT_USED if (write(pipe_fds[1], "\0", 1) < 0) ereport(WARNING, [parent: 8ebc1cfcf76d]