Blob Blame History Raw
--- cups-1.1.21/scheduler/main.c.pid	2004-09-24 11:29:05.073748138 +0100
+++ cups-1.1.21/scheduler/main.c	2004-09-24 11:44:35.826446564 +0100
@@ -349,6 +349,8 @@
     * Setup signal handlers for the parent...
     */
 
+    pid_t pid;
+
 #ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
     sigset(SIGUSR1, parent_handler);
     sigset(SIGCHLD, parent_handler);
@@ -372,7 +374,7 @@
     signal(SIGHUP, SIG_IGN);
 #endif /* HAVE_SIGSET */
 
-    if (fork() > 0)
+    if ((pid = fork()) > 0)
     {
      /*
       * OK, wait for the child to startup and send us SIGUSR1 or to crash
@@ -384,7 +386,15 @@
         sleep(1);
 
       if (parent_signal == SIGUSR1)
+      {
+        FILE *f = fopen ("/var/run/cupsd.pid", "w");
+        if (f)
+        {
+          fprintf (f, "%d\n", pid);
+          fclose (f);
+        }
         return (0);
+      }
 
       if (wait(&i) < 0)
       {