- for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++)
- sleep (5);
- }
-
- switch (distsw ? child_id : OK) {
- case NOTOK:
- inform("unable to fork, so checking directly...");
- /* FALLTHRU */
- case OK:
- execvp (postproc, vec);
- fprintf (stderr, "unable to exec ");
- perror (postproc);
- _exit (-1);
-
- default:
- SIGNAL (SIGHUP, SIG_IGN);
- SIGNAL (SIGINT, SIG_IGN);
- SIGNAL (SIGQUIT, SIG_IGN);
- SIGNAL (SIGTERM, SIG_IGN);
-
- status = pidwait(child_id, OK);
-
- (void) m_unlink (msg);
- if (rename (backup, msg) == NOTOK)
- adios (msg, "unable to rename %s to", backup);
- done (status);
+ if ((child_id = fork()) == -1)
+ adios("fork", "failed:");
+
+ if (child_id) {
+ SIGNAL (SIGHUP, SIG_IGN);
+ SIGNAL (SIGINT, SIG_IGN);
+ SIGNAL (SIGQUIT, SIG_IGN);
+ SIGNAL (SIGTERM, SIG_IGN);
+
+ status = pidwait(child_id, OK);
+
+ (void) m_unlink (msg);
+ if (rename (backup, msg) == NOTOK)
+ adios (msg, "unable to rename %s to", backup);
+ done (status);
+ }