aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-exec.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2001-07-06 17:58:53 +0000
committerPeter Eisentraut <peter_e@gmx.net>2001-07-06 17:58:53 +0000
commite77aaade349e3947a55c41f07eb80c4f5260ada4 (patch)
tree16fd7907ec02d35eb45acbf6d6cee440cb9be9ec /src/interfaces/libpq/fe-exec.c
parent9981b0f9effd149ebf012d52db50d0e2d3cd513f (diff)
downloadpostgresql-e77aaade349e3947a55c41f07eb80c4f5260ada4.tar.gz
postgresql-e77aaade349e3947a55c41f07eb80c4f5260ada4.zip
Repair libpq to follow protocol by not sending Terminate messages before
the startup exchange is complete. Also make sure that packets defined as single bytes aren't sent with a trailing '\0'.
Diffstat (limited to 'src/interfaces/libpq/fe-exec.c')
-rw-r--r--src/interfaces/libpq/fe-exec.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c
index e7838315eca..78d57369083 100644
--- a/src/interfaces/libpq/fe-exec.c
+++ b/src/interfaces/libpq/fe-exec.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.101 2001/02/10 02:31:30 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.102 2001/07/06 17:58:53 petere Exp $
*
*-------------------------------------------------------------------------
*/
@@ -556,8 +556,7 @@ PQsendQuery(PGconn *conn, const char *query)
return 0;
/* 'Q' == queries */
/* XXX: if we fail here we really ought to not block */
- if (pqPutnchar("Q", 1, conn) ||
- pqPuts(query, conn))
+ if (pqPutc('Q', conn) != 0 || pqPuts(query, conn) != 0)
{
handleSendFailure(conn);
return 0;
@@ -567,7 +566,7 @@ PQsendQuery(PGconn *conn, const char *query)
* give the data a push, ignore the return value as ConsumeInput()
* will do any aditional flushing if needed
*/
- (void) pqFlush(conn);
+ pqFlush(conn);
}
else
{
@@ -575,9 +574,8 @@ PQsendQuery(PGconn *conn, const char *query)
/*
* the frontend-backend protocol uses 'Q' to designate queries
*/
- if (pqPutnchar("Q", 1, conn) ||
- pqPuts(query, conn) ||
- pqFlush(conn))
+ if (pqPutc('Q', conn) != 0 || pqPuts(query, conn) != 0 ||
+ pqFlush(conn) != 0)
{
handleSendFailure(conn);
return 0;
@@ -1655,9 +1653,9 @@ PQfn(PGconn *conn,
return NULL;
}
- if (pqPuts("F ", conn) || /* function */
- pqPutInt(fnid, 4, conn) || /* function id */
- pqPutInt(nargs, 4, conn)) /* # of args */
+ if (pqPuts("F ", conn) != 0 || /* function */
+ pqPutInt(fnid, 4, conn) != 0 || /* function id */
+ pqPutInt(nargs, 4, conn) != 0) /* # of args */
{
handleSendFailure(conn);
return NULL;