From: Magnus Hagander Date: Tue, 13 Apr 2010 08:16:09 +0000 (+0000) Subject: Only try to do a graceful disconnect if we've successfully loaded the X-Git-Tag: REL9_0_0~588 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=a95d15ff5dd58ed1d8889e2476748a3ea49a9bf1;p=pg-rex%2Fsyncrep.git Only try to do a graceful disconnect if we've successfully loaded the shared library with the disconnect function in it. Fixes segmentation fault reported by Jeff Davis. Fujii Masao --- diff --git a/src/backend/replication/walreceiver.c b/src/backend/replication/walreceiver.c index 4dedcdc8b2..090111bb11 100644 --- a/src/backend/replication/walreceiver.c +++ b/src/backend/replication/walreceiver.c @@ -29,7 +29,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/replication/walreceiver.c,v 1.7 2010/03/21 00:17:58 petere Exp $ + * $PostgreSQL: pgsql/src/backend/replication/walreceiver.c,v 1.8 2010/04/13 08:16:09 mha Exp $ * *------------------------------------------------------------------------- */ @@ -330,7 +330,8 @@ WalRcvDie(int code, Datum arg) SpinLockRelease(&walrcv->mutex); /* Terminate the connection gracefully. */ - walrcv_disconnect(); + if (walrcv_disconnect != NULL) + walrcv_disconnect(); } /* SIGHUP: set flag to re-read config file at next convenient time */