]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
The scheduler now sets the process group for child processes and manages the
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Wed, 18 May 2011 17:28:45 +0000 (17:28 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Wed, 18 May 2011 17:28:45 +0000 (17:28 +0000)
group (STR #2829)

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@9781 7a7537e8-13f0-0310-91df-b6672ffda945

CHANGES.txt
config-scripts/cups-common.m4
config.h.in
scheduler/process.c
vcnet/config.h
xcode/config.h

index f7d609ecfe0acb20941c8cadfdbc3784ebc4cbec..bd806f899009d633d92d82e5b005bbf19c282a70 100644 (file)
@@ -1,8 +1,10 @@
-CHANGES.txt - 2011-05-11
+CHANGES.txt - 2011-05-18
 ------------------------
 
 CHANGES IN CUPS V1.5b1
 
+       - The scheduler now sets the process group for child processes and
+         manages the group (STR #2829)
        - Fixed some minor issues discovered by a Coverity scan (STR #3838)
        - The scheduler now more carefully creates and removes configuration,
          cache, and state files (STR #3715)
index 5fd9143dcbeb664a159e009145e95f588de1a6e5..511795de3465bd04b74d0431e4d50dda05f5cde2 100644 (file)
@@ -166,6 +166,9 @@ AC_CHECK_FUNCS(random lrand48 arc4random)
 dnl Check for geteuid function.
 AC_CHECK_FUNCS(geteuid)
 
+dnl Check for setpgid function.
+AC_CHECK_FUNCS(setpgid)
+
 dnl Check for vsyslog function.
 AC_CHECK_FUNCS(vsyslog)
 
index 20988405fba8ba7b9a5c7018e56f068617a1e64f..13f6411fd381a506ef5275a2847166196072a963 100644 (file)
 #undef HAVE_GETEUID
 
 
+/*
+ * Do we have the setpgid() function?
+ */
+
+#undef HAVE_SETPGID
+
+
 /*
  * Do we have the vsyslog() function?
  */
index 5e4e9e7ed6055658a016e85b6c3da8c2c15d00da..3d8247914b860110e4813e054a28923eed48a954 100644 (file)
@@ -246,9 +246,9 @@ cupsdEndProcess(int pid,            /* I - Process ID */
   if (!pid)
     return (0);
   else if (force)
-    return (kill(pid, SIGKILL));
+    return (kill(-pid, SIGKILL));
   else
-    return (kill(pid, SIGTERM));
+    return (kill(-pid, SIGTERM));
 }
 
 
@@ -476,6 +476,19 @@ cupsdStartProcess(
     if (!root)
       nice(FilterNice);
 
+   /*
+    * Put this process in its own process group so that we can kill any child
+    * processes it creates.
+    */
+
+#ifdef HAVE_SETPGID
+    if (setpgid(0, 0))
+      exit(errno);
+#else
+    if (setpgrp())
+      exit(errno);
+#endif /* HAVE_SETPGID */
+
    /*
     * Change user to something "safe"...
     */
index 7be500d3669a737851e21e58ac188f931f50dd33..e7405facc245299e65b0f5780d4e00462507571e 100644 (file)
 /* #undef HAVE_GETEUID */
 
 
+/*
+ * Do we have the setpgid() function?
+ */
+
+/* #undef HAVE_SETPGID */
+
+
 /*
  * Do we have the vsyslog() function?
  */
index fabfac8d1b890fd7bfd5e8a64fab7a958f4a4632..6e97a43a8dc0a474f2e9e4a9cae2a2c89a46271b 100644 (file)
 #define HAVE_GETEUID 1
 
 
+/*
+ * Do we have the setpgid() function?
+ */
+
+#define HAVE_SETPGID 1
+
+
 /*
  * Do we have the vsyslog() function?
  */