]> git.ipfire.org Git - people/amarx/ipfire-3.x.git/blobdiff - cups/patches/010_cups-pid.patch
cups: Update to latest stable release 1.6.1.
[people/amarx/ipfire-3.x.git] / cups / patches / 010_cups-pid.patch
diff --git a/cups/patches/010_cups-pid.patch b/cups/patches/010_cups-pid.patch
new file mode 100644 (file)
index 0000000..23ffd47
--- /dev/null
@@ -0,0 +1,37 @@
+diff -up cups-1.5b1/scheduler/main.c.pid cups-1.5b1/scheduler/main.c
+--- cups-1.5b1/scheduler/main.c.pid    2011-05-18 22:44:16.000000000 +0200
++++ cups-1.5b1/scheduler/main.c        2011-05-23 18:01:20.000000000 +0200
+@@ -311,6 +311,8 @@ main(int  argc,                            /* I - Number of comm
+     * 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);
+@@ -334,7 +336,7 @@ main(int  argc,                            /* I - Number of comm
+     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
+@@ -346,7 +348,15 @@ main(int  argc,                           /* I - Number of comm
+         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)
+       {