pgpool2.git / summary / log / commit / refs

commit    3379b75573f5f3a85f40ba6396ca5132baec46f1
Author:   Guillaume Lelarge <guillaume at lelarge.info>
Date:     Tue Aug 10 15:08:32 2010 +0000

    Fix some warnings on gcc.


main.c | 5 +++-- pool_error.c | 21 ++++++++++++--------- pool_hba.c | 4 ++-- pool_process_query.c | 4 ++-- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/main.c b/main.c index 0b9d63541..8257b1247 100644 --- a/main.c +++ b/main.c @@ -726,6 +726,7 @@ static void daemonize(void) int i; pid_t pid; int fdlimit; + int rc_chdir; pid = fork(); if (pid == (pid_t) -1) @@ -752,7 +753,7 @@ static void daemonize(void) mypid = getpid(); - chdir("/"); + rc_chdir = chdir("/"); i = open("/dev/null", O_RDWR); dup2(i, 0); @@ -1158,7 +1159,7 @@ static int create_unix_domain_socket(struct sockaddr_un un_addr_tmp) } memset((char *) &addr, 0, sizeof(addr)); addr.sun_family = AF_UNIX; - snprintf(addr.sun_path, sizeof(addr.sun_path), un_addr_tmp.sun_path); + snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", un_addr_tmp.sun_path); len = sizeof(struct sockaddr_un); status = bind(fd, (struct sockaddr *)&addr, len); if (status == -1) diff --git a/pool_error.c b/pool_error.c index e4dd6918f..220edc64f 100644 --- a/pool_error.c +++ b/pool_error.c @@ -42,6 +42,7 @@ void pool_error(const char *fmt,...) va_list ap; #ifdef HAVE_ASPRINTF char *fmt2; + int len; #endif #ifdef HAVE_SIGPROCMASK @@ -54,11 +55,11 @@ void pool_error(const char *fmt,...) if (pool_config->print_timestamp) #ifdef HAVE_ASPRINTF - asprintf(&fmt2, "%s ERROR: pid %d: %s\n", nowsec(), (int)getpid(), fmt); + len = asprintf(&fmt2, "%s ERROR: pid %d: %s\n", nowsec(), (int)getpid(), fmt); else - asprintf(&fmt2, "ERROR: pid %d: %s\n", (int)getpid(), fmt); + len = asprintf(&fmt2, "ERROR: pid %d: %s\n", (int)getpid(), fmt); - if (fmt2) + if (len >= 0 && fmt2) { va_start(ap, fmt); vfprintf(stderr, fmt2, ap); @@ -85,6 +86,7 @@ void pool_debug(const char *fmt,...) va_list ap; #ifdef HAVE_ASPRINTF char *fmt2; + int len; #endif #ifdef HAVE_SIGPROCMASK @@ -108,11 +110,11 @@ void pool_debug(const char *fmt,...) if (pool_config->print_timestamp) #ifdef HAVE_ASPRINTF - asprintf(&fmt2, "%s DEBUG: pid %d: %s\n", nowsec(), (int)getpid(), fmt); + len = asprintf(&fmt2, "%s DEBUG: pid %d: %s\n", nowsec(), (int)getpid(), fmt); else - asprintf(&fmt2, "DEBUG: pid %d: %s\n", (int)getpid(), fmt); + len = asprintf(&fmt2, "DEBUG: pid %d: %s\n", (int)getpid(), fmt); - if (fmt2) + if (len >= 0 && fmt2) { va_start(ap, fmt); vfprintf(stderr, fmt2, ap); @@ -139,6 +141,7 @@ void pool_log(const char *fmt,...) va_list ap; #ifdef HAVE_ASPRINTF char *fmt2; + int len; #endif #ifdef HAVE_SIGPROCMASK @@ -151,11 +154,11 @@ void pool_log(const char *fmt,...) if (pool_config->print_timestamp) #ifdef HAVE_ASPRINTF - asprintf(&fmt2, "%s LOG: pid %d: %s\n", nowsec(), (int)getpid(), fmt); + len = asprintf(&fmt2, "%s LOG: pid %d: %s\n", nowsec(), (int)getpid(), fmt); else - asprintf(&fmt2, "LOG: pid %d: %s\n", (int)getpid(), fmt); + len = asprintf(&fmt2, "LOG: pid %d: %s\n", (int)getpid(), fmt); - if (fmt2) + if (len >= 0 && fmt2) { va_start(ap, fmt); vfprintf(stderr, fmt2, ap); diff --git a/pool_hba.c b/pool_hba.c index 448d57df0..90ea92234 100644 --- a/pool_hba.c +++ b/pool_hba.c @@ -202,7 +202,7 @@ void ClientAuthentication(POOL_CONNECTION *frontend) "no pool_hba.conf entry for host \"%s\", user \"%s\", database \"%s\"", hostinfo, frontend->username, frontend->database); #endif - pool_error(errmessage); + pool_error("%s", errmessage); pool_send_error_message(frontend, frontend->protoVersion, "XX000", errmessage, "", "", __FILE__, __LINE__); @@ -418,7 +418,7 @@ static void auth_failed(POOL_CONNECTION *frontend) break; } - pool_error(errmessage); + pool_error("%s", errmessage); if (send_error_to_frontend) pool_send_error_message(frontend, frontend->protoVersion, "XX000", errmessage, "", "", __FILE__, __LINE__); diff --git a/pool_process_query.c b/pool_process_query.c index 1b9c228a2..76dd17784 100644 --- a/pool_process_query.c +++ b/pool_process_query.c @@ -1217,7 +1217,7 @@ POOL_STATUS SimpleForwardToFrontend(char kind, POOL_CONNECTION *frontend, pool_send_error_message(frontend, MAJOR(backend), "XX001", msg->data, "", "check data consistency between master and other db node", __FILE__, __LINE__); - pool_error(msg->data); + pool_error("%s", msg->data); free_string(msg); msg = init_string("SimpleForwardToFrontend: Number of affected tuples are:"); @@ -3278,7 +3278,7 @@ POOL_STATUS read_kind_from_backend(POOL_CONNECTION *frontend, POOL_CONNECTION_PO msg->data, "", "check data consistency among db nodes", __FILE__, __LINE__); - pool_error(msg->data); + pool_error("%s", msg->data); free_string(msg); [parent: fa0513ea2ea5]