-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathcups-pid.patch
More file actions
36 lines (32 loc) · 910 Bytes
/
cups-pid.patch
File metadata and controls
36 lines (32 loc) · 910 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
--- cups-1.1.21/scheduler/main.c.pid 2004-09-24 11:29:05.073748138 +0100
+++ cups-1.1.21/scheduler/main.c 2004-09-24 11:44:35.826446564 +0100
@@ -349,6 +349,8 @@
* 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);
@@ -372,7 +374,7 @@
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
@@ -384,7 +386,15 @@
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)
{