4743e1
diff -up cups-1.5b1/scheduler/main.c.pid cups-1.5b1/scheduler/main.c
4743e1
--- cups-1.5b1/scheduler/main.c.pid	2011-05-18 22:44:16.000000000 +0200
4743e1
+++ cups-1.5b1/scheduler/main.c	2011-05-23 18:01:20.000000000 +0200
4743e1
@@ -311,6 +311,8 @@ main(int  argc,				/* I - Number of comm
aee6db
     * Setup signal handlers for the parent...
aee6db
     */
aee6db
 
aee6db
+    pid_t pid;
aee6db
+
aee6db
 #ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
aee6db
     sigset(SIGUSR1, parent_handler);
aee6db
     sigset(SIGCHLD, parent_handler);
4743e1
@@ -334,7 +336,7 @@ main(int  argc,				/* I - Number of comm
aee6db
     signal(SIGHUP, SIG_IGN);
aee6db
 #endif /* HAVE_SIGSET */
aee6db
 
aee6db
-    if (fork() > 0)
aee6db
+    if ((pid = fork()) > 0)
aee6db
     {
aee6db
      /*
aee6db
       * OK, wait for the child to startup and send us SIGUSR1 or to crash
4743e1
@@ -346,7 +348,15 @@ main(int  argc,				/* I - Number of comm
aee6db
         sleep(1);
aee6db
 
aee6db
       if (parent_signal == SIGUSR1)
aee6db
+      {
aee6db
+        FILE *f = fopen ("/var/run/cupsd.pid", "w");
aee6db
+        if (f)
aee6db
+        {
aee6db
+          fprintf (f, "%d\n", pid);
aee6db
+          fclose (f);
aee6db
+        }
aee6db
         return (0);
aee6db
+      }
aee6db
 
aee6db
       if (wait(&i) < 0)
aee6db
       {