summaryrefslogtreecommitdiffstats
path: root/support/check_forensic
diff options
context:
space:
mode:
authorThom May <thommay@apache.org>2005-01-18 13:27:12 +0100
committerThom May <thommay@apache.org>2005-01-18 13:27:12 +0100
commita804be40993a5e0309b95a11b1356eb506d3fb56 (patch)
tree33060fe3e0aea7bb65c7e4ea71deee982e55f0de /support/check_forensic
parentadjust revision references (diff)
downloadapache2-a804be40993a5e0309b95a11b1356eb506d3fb56.tar.xz
apache2-a804be40993a5e0309b95a11b1356eb506d3fb56.zip
support/check_forensic: Fix temp file usage
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
Diffstat (limited to '')
-rwxr-xr-xsupport/check_forensic16
1 files changed, 11 insertions, 5 deletions
diff --git a/support/check_forensic b/support/check_forensic
index a3b530917b..a37ee897e5 100755
--- a/support/check_forensic
+++ b/support/check_forensic
@@ -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