pgpool2.git / summary / log / commit / refs
commit ea6cc5ad597b0975dd68f2632d027af26fc2deab
Author: Tatsuo Ishii <ishii at sraoss.co.jp>
Date: Wed Jul 22 08:51:49 2009 +0000
Fix various pool_error/log format errors.
Patch provided by Akio Ishida.
child.c | 2 +-
main.c | 20 +++-----------------
pool.h | 9 +++++++++
pool_process_query.c | 2 +-
pool_proto_modules.c | 8 ++++----
pool_rewrite_outfuncs.c | 2 +-
pool_shmem.c | 8 ++++----
7 files changed, 23 insertions(+), 28 deletions(-)
diff --git a/child.c b/child.c
index e19c07831..a9c9ca8ee 100644
--- a/child.c
+++ b/child.c
@@ -1653,7 +1653,7 @@ static int s_do_auth(POOL_CONNECTION_POOL_SLOT *cp, char *password)
}
else
{
- pool_error("s_do_auth: auth kind %d not supported yet");
+ pool_error("s_do_auth: auth kind %d not supported yet", auth_kind);
return -1;
}
diff --git a/main.c b/main.c
index 88bac226c..9da321966 100644
--- a/main.c
+++ b/main.c
@@ -172,26 +172,12 @@ char **myargv;
int main(int argc, char **argv)
{
int opt;
- int optindex;
int i;
int pid;
int size;
int retrycnt;
int sys_retrycnt;
- static struct option long_options[] = {
- {"hba-file", required_argument, NULL, 'a'},
- {"clear-cache", no_argument, NULL, 'c'},
- {"debug", no_argument, NULL, 'd'},
- {"config-file", required_argument, NULL, 'f'},
- {"pcp-password-file", required_argument, NULL, 'F'},
- {"help", no_argument, NULL, 'h'},
- {"mode", required_argument, NULL, 'm'},
- {"no-daemon", no_argument, NULL, 'n'},
- {"version", no_argument, NULL, 'v'},
- {NULL, 0, NULL, 0}
- };
-
myargc = argc;
myargv = argv;
@@ -199,7 +185,7 @@ int main(int argc, char **argv)
snprintf(pcp_conf_file, sizeof(pcp_conf_file), "%s/%s", DEFAULT_CONFIGDIR, PCP_PASSWD_FILE_NAME);
snprintf(hba_file, sizeof(hba_file), "%s/%s", DEFAULT_CONFIGDIR, HBA_CONF_FILE_NAME);
- while ((opt = getopt_long(argc, argv, "a:cdf:F:hm:nv", long_options, &optindex)) != -1)
+ while ((opt = getopt(argc, argv, "a:cdf:F:hm:nv")) != -1)
{
switch (opt)
{
@@ -1023,7 +1009,7 @@ void degenerate_backend_set(int *node_id_set, int count)
if (node_id_set[i] < 0 || node_id_set[i] >= MAX_NUM_BACKENDS ||
!VALID_BACKEND(node_id_set[i]))
{
- pool_log("notice_backend_error: node %d is not valid backend.");
+ pool_log("notice_backend_error: node %d is not valid backend.", i);
continue;
}
@@ -1045,7 +1031,7 @@ void send_failback_request(int node_id)
if (node_id < 0 || node_id >= MAX_NUM_BACKENDS || VALID_BACKEND(node_id))
{
- pool_error("send_failback_request: node %d is alive.");
+ pool_error("send_failback_request: node %d is alive.", node_id);
return;
}
diff --git a/pool.h b/pool.h
index 8b693b077..290eb4f9b 100644
--- a/pool.h
+++ b/pool.h
@@ -434,9 +434,18 @@ extern char query_string_buffer[]; /* last query string sent to simpleQuery() *
*/
extern char *get_config_file_name(void);
extern char *get_hba_file_name(void);
+#ifdef __GNUC__
+extern void pool_error(const char *fmt,...)
+ __attribute__((format (printf, 1, 2)));
+extern void pool_debug(const char *fmt,...)
+ __attribute__((format (printf, 1, 2)));
+extern void pool_log(const char *fmt,...)
+ __attribute__((format (printf, 1, 2)));
+#else
extern void pool_error(const char *fmt,...);
extern void pool_debug(const char *fmt,...);
extern void pool_log(const char *fmt,...);
+#endif
extern int pool_init_config(void);
extern int pool_get_config(char *confpath, POOL_CONFIG_CONTEXT context);
extern void do_child(int unix_fd, int inet_fd);
diff --git a/pool_process_query.c b/pool_process_query.c
index 15ab27c1f..d25686a8b 100644
--- a/pool_process_query.c
+++ b/pool_process_query.c
@@ -749,7 +749,7 @@ POOL_STATUS pool_parallel_exec(POOL_CONNECTION *frontend,
if((kind == 'C' || kind == 'c' || kind == 'E') &&
used_count == NUM_BACKENDS -1)
{
- pool_debug("pool_parallel_exec: kind from backend: D %ul", datacount);
+ pool_debug("pool_parallel_exec: kind from backend: D %lu", datacount);
if(error_flag == 0)
{
diff --git a/pool_proto_modules.c b/pool_proto_modules.c
index 8676ea1ea..b7e524ff3 100644
--- a/pool_proto_modules.c
+++ b/pool_proto_modules.c
@@ -1035,7 +1035,7 @@ POOL_STATUS Parse(POOL_CONNECTION *frontend,
if (!VALID_BACKEND(i) || IS_MASTER_NODE_ID(i))
continue;
- pool_debug("waiting for %th backend completing the query", i);
+ pool_debug("waiting for %dth backend completing the query", i);
if (synchronize(CONNECTION(backend, i)))
return POOL_END;
}
@@ -1554,7 +1554,7 @@ POOL_STATUS CompleteCommandResponse(POOL_CONNECTION *frontend,
if (len != len1)
{
pool_debug("Complete Command Response: message length does not match between master(%d \"%s\",) and %d th server (%d \"%s\",)",
- len, string, len1, string1);
+ len, string, i, len1, string1);
free(string1);
return POOL_END;
@@ -1629,7 +1629,7 @@ int RowDescription(POOL_CONNECTION *frontend,
if (len != len1)
{
pool_error("RowDescription: field length does not match between backends master(%d) and %d th backend(%d)",
- ntohl(len), ntohl(len1));
+ ntohl(len), j, ntohl(len1));
return POOL_FATAL;
}
}
@@ -1941,7 +1941,7 @@ POOL_STATUS CursorResponse(POOL_CONNECTION *frontend,
{
pool_error("CursorResponse: length does not match between master(%d) and %d th backend(%d)",
len, i, len1);
- pool_error("CursorResponse: master(%s) %d th backend(%s)", string1, string);
+ pool_error("CursorResponse: master(%s) %d th backend(%s)", string1, i, string);
free(string1);
return POOL_END;
}
diff --git a/pool_rewrite_outfuncs.c b/pool_rewrite_outfuncs.c
index 4ebaad6e6..22edc3175 100644
--- a/pool_rewrite_outfuncs.c
+++ b/pool_rewrite_outfuncs.c
@@ -5295,7 +5295,7 @@ _rewriteResTarget(Node *BaseSelect, RewriteQuery *message, ConInfoTodblink *dbli
{
char *col_name = select->col_list[message->ret_num];
pool_debug("_rewriteResTarget: check(%d) ret_num=%d",message->current_select,message->ret_num);
- pool_debug("_rewriteResTarget: col ret_num=%d",message->current_select,col_name);
+ pool_debug("_rewriteResTarget: col ret_num=%d col_name=%s",message->current_select,col_name);
delay_string_append_char(message, str, " AS ");
delay_string_append_char(message, str, col_name);
diff --git a/pool_shmem.c b/pool_shmem.c
index 5b1c6d2db..a87527458 100644
--- a/pool_shmem.c
+++ b/pool_shmem.c
@@ -5,7 +5,7 @@
* pgpool: a language independent connection pool server for PostgreSQL
* written by Tatsuo Ishii
*
- * Portions Copyright (c) 2003-2008, PgPool Global Development Group
+ * Portions Copyright (c) 2003-2009, PgPool Global Development Group
* Portions Copyright (c) 2003-2004, PostgreSQL Global Development Group
*
* Permission to use, copy, modify, and distribute this software and
@@ -79,7 +79,7 @@ pool_shared_memory_create(size_t size)
if (memAddress == (void *) -1)
{
- pool_error("shmat(id=%d) failed: %s", shmid);
+ pool_error("shmat(id=%d) failed: %s", shmid, strerror(errno));
return NULL;
}
@@ -97,7 +97,7 @@ static void
IpcMemoryDetach(int status, Datum shmaddr)
{
if (shmdt((void *) shmaddr) < 0)
- pool_log("shmdt(%p) failed: %s", shmaddr, strerror(errno));
+ pool_log("shmdt(%p) failed: %s", (void *) shmaddr, strerror(errno));
}
/*
@@ -119,7 +119,7 @@ IpcMemoryDelete(int status, Datum shmId)
return;
if (shmctl(shmId, IPC_RMID, NULL) < 0)
- pool_log("shmctl(%d, %d, 0) failed: %s",
+ pool_log("shmctl(%lu, %d, 0) failed: %s",
shmId, IPC_RMID, strerror(errno));
}
[parent: 9f977ccbff9d]