Blame SOURCES/cups-pid.patch

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