]> git.ipfire.org Git - people/amarx/ipfire-3.x.git/blob - cups/patches/010_cups-pid.patch
23ffd47064334964a3c36a11277ead1a0647afa8
[people/amarx/ipfire-3.x.git] / cups / patches / 010_cups-pid.patch
1 diff -up cups-1.5b1/scheduler/main.c.pid cups-1.5b1/scheduler/main.c
2 --- cups-1.5b1/scheduler/main.c.pid 2011-05-18 22:44:16.000000000 +0200
3 +++ cups-1.5b1/scheduler/main.c 2011-05-23 18:01:20.000000000 +0200
4 @@ -311,6 +311,8 @@ main(int argc, /* I - Number of comm
5 * Setup signal handlers for the parent...
6 */
7
8 + pid_t pid;
9 +
10 #ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
11 sigset(SIGUSR1, parent_handler);
12 sigset(SIGCHLD, parent_handler);
13 @@ -334,7 +336,7 @@ main(int argc, /* I - Number of comm
14 signal(SIGHUP, SIG_IGN);
15 #endif /* HAVE_SIGSET */
16
17 - if (fork() > 0)
18 + if ((pid = fork()) > 0)
19 {
20 /*
21 * OK, wait for the child to startup and send us SIGUSR1 or to crash
22 @@ -346,7 +348,15 @@ main(int argc, /* I - Number of comm
23 sleep(1);
24
25 if (parent_signal == SIGUSR1)
26 + {
27 + FILE *f = fopen ("/var/run/cupsd.pid", "w");
28 + if (f)
29 + {
30 + fprintf (f, "%d\n", pid);
31 + fclose (f);
32 + }
33 return (0);
34 + }
35
36 if (wait(&i) < 0)
37 {