Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc0d7304

Browse files
committed
The attached patch fixes a problem that I seem to have introduced
with the new support for asynchronous NOTIFY in libpgtcl. Withthe current sources, if the backend disconnects unexpectedly thenthe tcl/tk application coredumps when control next reaches the idleloop. Oops.regards, tom lane
1 parenta738478 commitc0d7304

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

‎src/interfaces/libpgtcl/pgtclId.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
*
1414
* IDENTIFICATION
15-
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclId.c,v 1.12 1998/08/17 03:50:26 scrappy Exp $
15+
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclId.c,v 1.13 1998/08/22 04:34:22 momjian Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -475,14 +475,19 @@ static void Pg_Notify_SetupProc (ClientData clientData, int flags)
475475
{
476476
Pg_ConnectionId*connid= (Pg_ConnectionId*)clientData;
477477
Tcl_Filehandle;
478+
intpqsock;
478479

479480
/* We classify SQL notifies as Tcl file events. */
480481
if (!(flags&TCL_FILE_EVENTS)) {
481482
return;
482483
}
483484

484485
/* Set up to watch for asynchronous data arrival on backend channel */
485-
handle=Tcl_GetFile((ClientData)PQsocket(connid->conn),TCL_UNIX_FD);
486+
pqsock=PQsocket(connid->conn);
487+
if (pqsock<0)
488+
return;
489+
490+
handle=Tcl_GetFile((ClientData)pqsock,TCL_UNIX_FD);
486491
Tcl_WatchFile(handle,TCL_READABLE);
487492
}
488493

@@ -492,6 +497,7 @@ static void Pg_Notify_CheckProc (ClientData clientData, int flags)
492497
{
493498
Pg_ConnectionId*connid= (Pg_ConnectionId*)clientData;
494499
Tcl_Filehandle;
500+
intpqsock;
495501

496502
/* We classify SQL notifies as Tcl file events. */
497503
if (!(flags&TCL_FILE_EVENTS)) {
@@ -503,7 +509,11 @@ static void Pg_Notify_CheckProc (ClientData clientData, int flags)
503509
* We use Tcl_FileReady to avoid a useless kernel call
504510
* when no data is available.
505511
*/
506-
handle=Tcl_GetFile((ClientData)PQsocket(connid->conn),TCL_UNIX_FD);
512+
pqsock=PQsocket(connid->conn);
513+
if (pqsock<0)
514+
return;
515+
516+
handle=Tcl_GetFile((ClientData)pqsock,TCL_UNIX_FD);
507517
if (Tcl_FileReady(handle,TCL_READABLE)!=0) {
508518
PQconsumeInput(connid->conn);
509519
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp