diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2001-07-06 17:58:53 +0000 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2001-07-06 17:58:53 +0000 |
commit | e77aaade349e3947a55c41f07eb80c4f5260ada4 (patch) | |
tree | 16fd7907ec02d35eb45acbf6d6cee440cb9be9ec /src/interfaces/libpq/fe-misc.c | |
parent | 9981b0f9effd149ebf012d52db50d0e2d3cd513f (diff) | |
download | postgresql-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-misc.c')
-rw-r--r-- | src/interfaces/libpq/fe-misc.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c index 04be4bb692e..bcc3bdc9c84 100644 --- a/src/interfaces/libpq/fe-misc.c +++ b/src/interfaces/libpq/fe-misc.c @@ -25,7 +25,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.49 2001/05/28 15:29:51 tgl Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.50 2001/07/06 17:58:53 petere Exp $ * *------------------------------------------------------------------------- */ @@ -59,6 +59,8 @@ #define DONOTICE(conn,message) \ ((*(conn)->noticeHook) ((conn)->noticeArg, (message))) +static int pqPutBytes(const char *s, size_t nbytes, PGconn *conn); + /* --------------------------------------------------------------------- */ /* pqGetc: @@ -83,6 +85,22 @@ pqGetc(char *result, PGconn *conn) } +/* + * write 1 char to the connection + */ +int +pqPutc(char c, PGconn *conn) +{ + if (pqPutBytes(&c, 1, conn) == EOF) + return EOF; + + if (conn->Pfdebug) + fprintf(conn->Pfdebug, "To backend> %c\n", c); + + return 0; +} + + /* --------------------------------------------------------------------- */ /* pqPutBytes: local routine to write N bytes to the connection, with buffering |