]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
support/check_forensic: Fix temp file usage
authorThom May <thommay@apache.org>
Tue, 18 Jan 2005 12:27:12 +0000 (12:27 +0000)
committerThom May <thommay@apache.org>
Tue, 18 Jan 2005 12:27:12 +0000 (12:27 +0000)
Submitted By: Javier Fernandez-Sanguino Pen~a
Reviewed By: Thom May

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@125495 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
support/check_forensic

diff --git a/CHANGES b/CHANGES
index 37f0f4c0738a6765e8dc386cb05416f282597312..aba471b2c673ca311547e18475ceb103a9e1a8af 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@ Changes with Apache 2.1.3
 
   [Remove entries to the current 2.0 section below, when backported]
 
+  *) support/check_forensic: Fix temp file usage
+     [Javier Fernandez-Sanguino Pen~a <jfs computer.org>]
+
   *) mod_ssl: Add SSLCADNRequestFile and SSLCADNRequestPath directives
      which can be used to configure a specific list of CA names to send
      in a client certificate request.  PR 32848. 
index a3b530917bd9530c5fbede1eebed54c48117148d..a37ee897e589c24d3dd9a8baea3ba8bcef64ca2d 100755 (executable)
@@ -7,9 +7,15 @@
 
 F=$1
 
-cut -f 1 -d '|' $F  > /tmp/fc-all.$$
-grep + < /tmp/fc-all.$$ | cut -c2- | sort > /tmp/fc-in.$$
-grep -- - < /tmp/fc-all.$$ | cut -c2- | sort > /tmp/fc-out.$$
+all=`mktemp -t fcall.XXXXXX || tempfile --prefix=fcall` || { echo "$0: Cannot create temporary file" >&2; exit 1; }
+in=`mktemp -t fcin.XXXXXX || tempfile --prefix=fcin` || { echo "$0: Cannot create temporary file" >&2; exit 1; }
+out=`mktemp -t fcout.XXXXXX || tempfile --prefix=fcout` || { echo "$0: Cannot create temporary file" >&2; exit 1; }
+trap "rm -f -- \"$all\" \"$in\" \"$out\";" 0 1 2 3 13 15
+
+cut -f 1 -d '|' $F  > $all
+grep + < $all | cut -c2- | sort > $in
+grep -- - < $all | cut -c2- | sort > $out
+
 # use -i instead of -I for GNU xargs
-join -v 1 /tmp/fc-in.$$ /tmp/fc-out.$$ | xargs -I xx egrep "^\\+xx" $F
-rm /tmp/fc-all.$$ /tmp/fc-in.$$ /tmp/fc-out.$$
+join -v 1 $in $out | xargs -I xx egrep "^\\+xx" $F
+exit 0