ref: 7a543d7e7812826555a20c1e17a9ccc4f6cb2191
parent: 5379327ffc8239978258eacff93188200d055d4f
author: Ori Bernstein <[email protected]>
date: Wed Nov 11 10:47:16 EST 2020
log exec failures: at least the user should know...
--- a/mbox.c
+++ b/mbox.c
@@ -767,6 +767,19 @@
}
static void
+execlog(void*)
+{
+ Waitmsg *w;
+
+ while(1){
+ w = recvp(cwait);
+ if(w->msg[0] != 0)
+ fprint(2, "%d: %s\n", w->pid, w->msg);
+ free(w);
+ }
+}
+
+static void
mbmain(void*)
{
Event *ev;
@@ -862,10 +875,13 @@
mbload();
proccreate(plumbseemail, nil, Stack);
proccreate(plumbshowmail, nil, Stack);
+
+ /* avoid duplicate sends when multiple mailboxes are open */
if(sender || strcmp(mailbox, "mbox") == 0){
plumbsendmailfd = plumbopen("sendmail", OREAD|OCEXEC);
proccreate(plumbsendmail, nil, Stack);
}
+ threadcreate(execlog, nil, Stack);
threadcreate(mbmain, nil, Stack);
threadexits(nil);
}