On 2/21/22 8:05 PM, Lukasz Florczak wrote:
Moving signal setting in Monitor.c out of the alert() function
makes it more clear as it was set to ignore SIGPIPE every time
alert() was called, but was never set back to default again.
Now SIGPIPE is ignored for whole duration of the program just once.
Signed-off-by: Lukasz Florczak <lukasz.florczak@xxxxxxxxxxxxxxx>
Hi Lukasz,
This patch doesn't apply on branch 20220315-testing of the mdadm-CI
tree, could you please rebase this series on
git://git.kernel.org/pub/scm/linux/kernel/git/colyli/mdadm.git
20220315-testing
Then I will continue to test them.
Thanks.
Coly Li
---
Monitor.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/Monitor.c b/Monitor.c
index 40388b64..222568cb 100644
--- a/Monitor.c
+++ b/Monitor.c
@@ -159,6 +159,9 @@ int Monitor(struct mddev_dev *devlist,
info.mailfrom = mailfrom;
info.dosyslog = dosyslog;
+ if (info.mailaddr)
+ signal_s(SIGPIPE, SIG_IGN);
+
if (share){
if (check_one_sharer(c->scan))
return 1;
@@ -436,8 +439,7 @@ static void alert(char *event, char *dev, char *disc, struct alert_info *info)
char hname[256];
gethostname(hname, sizeof(hname));
- signal_s(SIGPIPE, SIG_IGN);
-
+
if (info->mailfrom)
fprintf(mp, "From: %s\n", info->mailfrom);
else