Skip to content

Commit 4fbd8de

Browse files
committed
Ignore SIGPIPE, handle EPIPE
We get this signal when writing to a socket when the other side closed the connection. This is wrong since this is not a fatal error. The right way to handle SIGPIPE is to ignore it and handle EPIPE when writing to socket, which we already do. Fixes: #48 Signed-off-by: Nir Soffer <[email protected]>
1 parent 8513f80 commit 4fbd8de

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,9 @@ int main(int argc, char *argv[]) {
399399
signal(SIGHUP, signalhandler);
400400
signal(SIGINT, signalhandler);
401401
signal(SIGTERM, signalhandler);
402-
signal(SIGPIPE, signalhandler);
402+
403+
// We will receive EPIPE on the socket.
404+
signal(SIGPIPE, SIG_IGN);
403405

404406
int pid_fd = -1;
405407
if (cliopt->pidfile != NULL) {

0 commit comments

Comments
 (0)