summaryrefslogtreecommitdiff
path: root/databases/pgcluster/files/patch-pool_process_query.c
diff options
context:
space:
mode:
authorJun Kuriyama <kuriyama@FreeBSD.org>2004-02-16 01:24:58 +0000
committerJun Kuriyama <kuriyama@FreeBSD.org>2004-02-16 01:24:58 +0000
commit4d3d3d85c9d57ff8eb2f0f771d14499881ea6170 (patch)
treecddfb357185eb649f43ea08dd8b91d28099ee474 /databases/pgcluster/files/patch-pool_process_query.c
parentfix build with perl5.8 by creating ${SITE_PERL} dir (diff)
o Fix some bugs in startup scripts.
o Add WITH_DEBUG knob. o Fix a bug of pglb which dumps core (obtained from ML). o Fix style bugs in debug messages.
Notes
Notes: svn path=/head/; revision=101004
Diffstat (limited to 'databases/pgcluster/files/patch-pool_process_query.c')
-rw-r--r--databases/pgcluster/files/patch-pool_process_query.c49
1 files changed, 46 insertions, 3 deletions
diff --git a/databases/pgcluster/files/patch-pool_process_query.c b/databases/pgcluster/files/patch-pool_process_query.c
index dbac865f22e0..e895ee978714 100644
--- a/databases/pgcluster/files/patch-pool_process_query.c
+++ b/databases/pgcluster/files/patch-pool_process_query.c
@@ -1,6 +1,49 @@
---- src/pgcluster/pglb/pool_process_query.c.orig Sat Jan 24 14:14:51 2004
-+++ src/pgcluster/pglb/pool_process_query.c Sat Jan 24 14:15:00 2004
-@@ -728,10 +728,11 @@
+--- src/pgcluster/pglb/pool_process_query.c.orig.orig Wed Feb 4 23:35:56 2004
++++ src/pgcluster/pglb/pool_process_query.c Wed Feb 4 23:37:29 2004
+@@ -459,20 +459,31 @@
+
+ pool_write(frontend, &size, sizeof(int));
+ size = htonl(size) - 4;
+- buf = malloc(size);
+- if (buf == NULL)
++
++ /* read and send actual data only when size > 0 */
++ if (size > 0)
+ {
+- show_error("AsciiRow: out of memory");
+- return POOL_END;
++ buf = malloc(size);
++ if (buf == NULL)
++ {
++ show_error("AsciiRow: out of memory");
++ return POOL_END;
++ }
++ /* actual data */
++ if (pool_read(backend, buf, size) < 0)
++ {
++ free(buf);
++ return POOL_END;
++ }
++ pool_write(frontend, buf, size);
++ snprintf(msgbuf, Min(sizeof(msgbuf), size), "%s", buf);
++ free(buf);
++ }
++ else
++ {
++ *msgbuf = '\0';
+ }
+- /* actual data */
+- if (pool_read(backend, buf, size) < 0)
+- return POOL_END;
+-
+- pool_write(frontend, buf, size);
+- snprintf(msgbuf, Min(sizeof(msgbuf), size), "%s", buf);
+ show_debug("AsciiRow: len:%d data: %s", size, msgbuf);
+- free(buf);
+ }
+ mask >>= 1;
+ }
+@@ -728,10 +739,11 @@
static POOL_STATUS EmptyQueryResponse(POOL_CONNECTION *frontend,
POOL_CONNECTION *backend)
{