Thread (7 messages) 7 messages, 3 authors, 2022-04-04

Re: [PATCH 2/2] Optimize signal setting in alert() function.

From: Coly Li <hidden>
Date: 2022-03-15 09:58:55

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 <redacted>
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


quoted hunk ↗ jump to hunk
---
  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
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help