]>
diplodocus.org Git - nmh/blob - sbr/push.c
3 * push.c -- push a fork into the background
5 * This code is Copyright (c) 2002, by the authors of nmh. See the
6 * COPYRIGHT file in the root directory of the nmh distribution for
7 * complete copyright information.
11 #include <h/signals.h>
20 for (i
= 0; (pid
= fork()) == -1 && i
< 5; i
++)
26 advise (NULL
, "unable to fork, so can't push...");
30 /* child, block a few signals and continue */
31 SIGNAL (SIGHUP
, SIG_IGN
);
32 SIGNAL (SIGINT
, SIG_IGN
);
33 SIGNAL (SIGQUIT
, SIG_IGN
);
34 SIGNAL (SIGTERM
, SIG_IGN
);
36 SIGNAL (SIGTSTP
, SIG_IGN
);
37 SIGNAL (SIGTTIN
, SIG_IGN
);
38 SIGNAL (SIGTTOU
, SIG_IGN
);
41 unregister_for_removal(0);
43 if (freopen ("/dev/null", "r", stdin
) == NULL
) {
44 advise ("stdin", "freopen");
46 if (freopen ("/dev/null", "w", stdout
) == NULL
) {
47 advise ("stdout", "freopen");
52 /* parent, just exit */