diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-09-02 23:41:17 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-09-02 23:41:17 +0000 |
commit | 00482fde8eb5318c067ec88c4aece08d4ff35db0 (patch) | |
tree | 0fc2848f9584f9130aed02db84cb664c3fcc275f /src/interfaces/libpgtcl/pgtclCmds.c | |
parent | b28b05317de33d1ddb5f91d93f178bcabb28b801 (diff) |
Partial solution for 'unexpected EOF' problem with pg_disconnect: it
seems we have a choice between annoying messages and leaking memory
(or dumping core, but that's right out). Patch also fixes several
other problems in pg_disconnect, such as being willing to close a
channel that isn't a PG channel.
Diffstat (limited to 'src/interfaces/libpgtcl/pgtclCmds.c')
-rw-r--r-- | src/interfaces/libpgtcl/pgtclCmds.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/interfaces/libpgtcl/pgtclCmds.c b/src/interfaces/libpgtcl/pgtclCmds.c index ca754688564..28680c90fc7 100644 --- a/src/interfaces/libpgtcl/pgtclCmds.c +++ b/src/interfaces/libpgtcl/pgtclCmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.66 2002/09/02 21:51:47 tgl Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.67 2002/09/02 23:41:16 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -399,7 +399,6 @@ Pg_connect(ClientData cData, Tcl_Interp *interp, int argc, char *argv[]) int Pg_disconnect(ClientData cData, Tcl_Interp *interp, int argc, char *argv[]) { - Pg_ConnectionId *connid; PGconn *conn; Tcl_Channel conn_chan; @@ -413,15 +412,14 @@ Pg_disconnect(ClientData cData, Tcl_Interp *interp, int argc, char *argv[]) if (conn_chan == NULL) { Tcl_ResetResult(interp); - Tcl_AppendResult(interp, argv[1], " is not a valid connection\n", 0); + Tcl_AppendResult(interp, argv[1], " is not a valid connection", 0); return TCL_ERROR; } -#if TCL_MAJOR_VERSION >= 8 - conn = PgGetConnectionId(interp, argv[1], &connid); - if (connid->notifier_channel != NULL) - Tcl_UnregisterChannel(interp, connid->notifier_channel); -#endif + /* Check that it is a PG connection and not something else */ + conn = PgGetConnectionId(interp, argv[1], (Pg_ConnectionId **) NULL); + if (conn == (PGconn *) NULL) + return TCL_ERROR; return Tcl_UnregisterChannel(interp, conn_chan); } |