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>
---
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);
Hi Lukasz,
I suggest to void extending th SIGPIPE range out of alert(), maybe
restore the old handler after pclose(mp)? Then we can keep minimized
logic change.
Thanks.
Coly Li
if (info->mailfrom)
fprintf(mp, "From: %s\n", info->mailfrom);
else