X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fsend.c;h=a735c6777e8d11ddfb136452a4c792b00b8921e5;hb=5f08476e3bc5c134ce57d924b01d1c1fcacd53db;hp=2ef1fe765356ea37ed27945b2f4e80c96b68de66;hpb=5fbf37ee68e018998ada61eeab73e035b26834b6;p=mmh diff --git a/uip/send.c b/uip/send.c index 2ef1fe7..a735c67 100644 --- a/uip/send.c +++ b/uip/send.c @@ -97,6 +97,7 @@ main(int argc, char **argv) int msgp = 0, nfiles = 0, distsw = 0, vecp = 1; int msgnum, status; int in, out; + int n; char *cp, *maildir = NULL; char buf[BUFSIZ], **ap, **argp, **arguments; char *msgs[MAXARGS], *vec[MAXARGS]; @@ -273,11 +274,40 @@ main(int argc, char **argv) st.st_ino = 0; } if (pushsw) { - push(); + /* push a fork into the background */ + pid_t pid; + + switch (pid = fork()) { + case -1: + /* fork error */ + advise(NULL, "unable to fork, so can't push..."); + break; + + default: + /* parent, just exit */ + done(0); + + case 0: + /* child, block a few signals and continue */ + SIGNAL(SIGHUP, SIG_IGN); + SIGNAL(SIGINT, SIG_IGN); + SIGNAL(SIGQUIT, SIG_IGN); + SIGNAL(SIGTERM, SIG_IGN); +#ifdef SIGTSTP + SIGNAL(SIGTSTP, SIG_IGN); + SIGNAL(SIGTTIN, SIG_IGN); + SIGNAL(SIGTTOU, SIG_IGN); +#endif + freopen("/dev/null", "r", stdin); + freopen("/dev/null", "w", stdout); + break; + } } status = 0; - vec[0] = mhbasename(postproc); - closefds(3); + vec[0] = "spost"; + for (n=3; n