open-iscsi/0022-Fix-SIGPIPE-loop-in-signal-handler.patch
2020-10-31 17:29:53 +08:00

31 lines
904 B
Diff

From 71e4ce5e7722dde25751025cac0e8b29d8d540df Mon Sep 17 00:00:00 2001
From: fredvx <48496214+fredvx@users.noreply.github.com>
Date: Wed, 22 Apr 2020 14:24:50 -0400
Subject: [PATCH 161/170] Fix SIGPIPE loop in signal handler
---
usr/iscsid.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/usr/iscsid.c b/usr/iscsid.c
index 99d27ab..e501498 100644
--- a/usr/iscsid.c
+++ b/usr/iscsid.c
@@ -310,7 +310,12 @@ static void iscsid_shutdown(void)
static void catch_signal(int signo)
{
- log_debug(1, "pid %d caught signal %d", getpid(), signo);
+ /*
+ * Do not try to call log_debug() if there is a PIPE error
+ * because we can get caught in a PIPE error loop.
+ */
+ if (signo != SIGPIPE)
+ log_debug(1, "pid %d caught signal %d", getpid(), signo);
/* In foreground mode, treat SIGINT like SIGTERM */
if (!daemonize && signo == SIGINT)
--
2.21.1 (Apple Git-122.3)