X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fsend.c;h=5054273b61b762649a13ff5068bdae7dd536b0ce;hb=66ef547b1aa9794afb6137927aa3cd7335522c64;hp=d87e211fe0be676d9fffbedb3af86179c88ec4cf;hpb=3b91e463fc7a4db9e7b69e2e0f4f7909339beea5;p=mmh diff --git a/uip/send.c b/uip/send.c index d87e211..5054273 100644 --- a/uip/send.c +++ b/uip/send.c @@ -273,7 +273,34 @@ 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] = "spost";