Date: Fri, 01 Dec 2000 01:52:23 -0500 (EST) From: Mike Heffner <mheffner@vt.edu> To: FreeBSD-audit <FreeBSD-audit@freebsd.org> Subject: manctl(8) tempfile fix Message-ID: <XFMail.20001201015223.mheffner@vt.edu>
next in thread | raw e-mail | index | archive | help
This patch changes manctl(8) to use mktemp rather than shell pid substitution
for tempfile names. Reviews?
--- manctl.sh.orig Fri Dec 1 01:24:35 2000
+++ manctl.sh Fri Dec 1 01:42:39 2000
@@ -94,12 +94,13 @@
else
if [ $2 != "symbolic" ] ; then
echo gunzipping page $pname 1>&2
- gunzip -c $pname > /tmp/manager.$$
+ temp=`mktemp /tmp/managerXXXXXXXXXX` || exit 1
+ gunzip -c $pname > $temp
chmod u+w $pname
- cp /tmp/manager.$$ $pname
+ cp $temp $pname
chmod 444 $pname
mv $pname $fname.$sect
- rm /tmp/manager.$$
+ rm -f $temp
else
# skip symlinks - this can be
# a program like expn, which is
@@ -180,11 +181,13 @@
ln ../$2 $fname
else
echo inlining page $fname 1>&2
+ temp=`mktemp /tmp/managerXXXXXXXXXX` || exit 1
cat $fname | \
- (cd .. ; soelim ) > /tmp/manager.$$
+ (cd .. ; soelim ) > $temp
chmod u+w $fname
- cp /tmp/manager.$$ $fname
+ cp $temp $fname
chmod 444 $fname
+ rm -f $temp
fi
}
@@ -279,13 +282,14 @@
else
if [ $2 != "symbolic" ] ; then
echo gzipping page $pname 1>&2
+ temp=`mktemp /tmp/managerXXXXXXXXXX` || exit 1
cat $pname | \
- (cd .. ; soelim )| gzip -c -- > /tmp/manager.$$
+ (cd .. ; soelim )| gzip -c -- > $temp
chmod u+w $pname
- cp /tmp/manager.$$ $pname
+ cp $temp $pname
chmod 444 $pname
mv $pname $pname.gz
- rm /tmp/manager.$$
+ rm -f $temp
else
# skip symlink - this can be
# a program like expn, which is
--
Mike Heffner <mheffner@vt.edu>
Blacksburg, VA ICQ# 882073
http://my.ispchannel.com/~mheffner
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20001201015223.mheffner>
