/*
- * "$Id: main.c,v 1.57.2.44 2003/05/01 18:00:19 mike Exp $"
+ * "$Id: main.c,v 1.57.2.45 2003/05/02 15:54:50 mike Exp $"
*
* Scheduler main loop for the Common UNIX Printing System (CUPS).
*
if (!fg)
{
- if (fork() > 0)
- {
- /*
- * OK, wait for the child to startup and send us SIGUSR1... We
- * also need to ignore SIGHUP which might be sent by the init
- * script to restart the scheduler...
- */
+ /*
+ * Setup signal handlers for the parent...
+ */
#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
- sigset(SIGUSR1, sigusr1_handler);
+ sigset(SIGUSR1, sigusr1_handler);
- sigset(SIGHUP, SIG_IGN);
+ sigset(SIGHUP, SIG_IGN);
#elif defined(HAVE_SIGACTION)
- memset(&action, 0, sizeof(action));
- sigemptyset(&action.sa_mask);
- sigaddset(&action.sa_mask, SIGUSR1);
- action.sa_handler = sigusr1_handler;
- sigaction(SIGUSR1, &action, NULL);
-
- sigemptyset(&action.sa_mask);
- action.sa_handler = SIG_IGN;
- sigaction(SIGHUP, &action, NULL);
+ memset(&action, 0, sizeof(action));
+ sigemptyset(&action.sa_mask);
+ sigaddset(&action.sa_mask, SIGUSR1);
+ action.sa_handler = sigusr1_handler;
+ sigaction(SIGUSR1, &action, NULL);
+
+ sigemptyset(&action.sa_mask);
+ action.sa_handler = SIG_IGN;
+ sigaction(SIGHUP, &action, NULL);
#else
- signal(SIGUSR1, sigusr1_handler);
+ signal(SIGUSR1, sigusr1_handler);
- signal(SIGHUP, SIG_IGN);
+ signal(SIGHUP, SIG_IGN);
#endif /* HAVE_SIGSET */
+ if (fork() > 0)
+ {
+ /*
+ * OK, wait for the child to startup and send us SIGUSR1... We
+ * also need to ignore SIGHUP which might be sent by the init
+ * script to restart the scheduler...
+ */
+
if (wait(&i) < 0)
i = 0;
/*
- * End of "$Id: main.c,v 1.57.2.44 2003/05/01 18:00:19 mike Exp $".
+ * End of "$Id: main.c,v 1.57.2.45 2003/05/02 15:54:50 mike Exp $".
*/