]> git.gag.com Git - debian/amanda/blobdiff - client-src/killpgrp.c
Imported Upstream version 2.5.0p2
[debian/amanda] / client-src / killpgrp.c
index 9c12141a03ff4a5542e92104d64b3ec449890a32..1837409f96461ab6502601f651ced7cf0977feb4 100644 (file)
@@ -24,7 +24,7 @@
  * file named AUTHORS, in the root directory of this distribution.
  */
 /*
- * $Id: killpgrp.c,v 1.8.4.2.4.1 2002/10/27 14:31:18 martinea Exp $
+ * $Id: killpgrp.c,v 1.12 2005/09/20 21:32:25 jrjackson Exp $
  *
  * if it is the process group leader, it kills all processes in its
  * process group when it is killed itself.
@@ -52,18 +52,8 @@ int argc;
 char **argv;
 {
     amwait_t status;
-    int fd;
-
-    for(fd = 3; fd < FD_SETSIZE; fd++) {
-       /*
-        * Make sure nobody spoofs us with a lot of extra open files
-        * that would cause an open we do to get a very high file
-        * descriptor, which in turn might be used as an index into
-        * an array (e.g. an fd_set).
-        */
-       close(fd);
-    }
 
+    safe_fd(-1, 0);
     safe_cd();
 
     set_pname("killpgrp");
@@ -76,13 +66,11 @@ char **argv;
     }
 
 #ifdef FORCE_USERID
-    if (getuid() != client_uid) {
+    if (getuid() != client_uid)
        error("error [must be invoked by %s]", CLIENT_LOGIN);
-    }
 
-    if (geteuid() != 0) {
+    if (geteuid() != 0)
        error("error [must be setuid root]");
-    }
 #endif /* FORCE_USERID */
 
 #if !defined (DONT_SUID_ROOT)