Suppress compiler warnings.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Sat, 30 Mar 2019 12:29:41 +0000 (21:29 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Sat, 30 Mar 2019 12:33:01 +0000 (21:33 +0900)
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

index fc794f14728f12ba175421a1d82f732979956a0d..47b38cfd5486bc15e9fa2d344c9e6e58d4e28386 100644 (file)
@@ -201,6 +201,12 @@ static pid_t wd_lifecheck_pid = 0; /* pid for child process handling watchdog li
 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
 */
@@ -1519,7 +1525,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)
@@ -2307,7 +2313,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
@@ -2614,7 +2620,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,
@@ -2635,7 +2641,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,