Skip to content

Commit ff2177d

Browse files
committed
Suppress SIGPIPE
Signed-off-by: Daniel Farina <[email protected]>
1 parent 0e1feed commit ff2177d

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

pg_logfebe.c

+10-1
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,16 @@ sendOrInval(int *fd, char *payload, size_t payloadSz)
658658

659659
writeAgain:
660660
errno = 0;
661-
bytesWritten = send(*fd, payload, payloadSz, 0);
661+
662+
/*
663+
* Send, and carefully suppress SIGPIPE, which otherwise will
664+
* cause sendOrInval's error handling to function in since a
665+
* failure will come in as a signal rather than an error code.
666+
*
667+
* This is required to allow re-connection in event the server
668+
* closes the connection.
669+
*/
670+
bytesWritten = send(*fd, payload, payloadSz, MSG_NOSIGNAL);
662671

663672
if (bytesWritten < payloadSz)
664673
{

0 commit comments

Comments
 (0)