Blame SOURCES/cups-pid.patch

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