summaryrefslogtreecommitdiff
path: root/usr.bin/less/less.nro
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-07-17 22:06:16 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-07-17 22:06:16 +0000
commit4d599b3feeae918b144557e5bd932f7bcc1607ae (patch)
tree1d842af309988b6c597861feefb12a6fa3faacc9 /usr.bin/less/less.nro
parent678671e8d75e3f5924467e0851f91f860b7c50df (diff)
better example w/o /tmp race. Noted by Oleg Safiullin <form@vs.itam.nsc.ru
Diffstat (limited to 'usr.bin/less/less.nro')
-rw-r--r--usr.bin/less/less.nro10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/less/less.nro b/usr.bin/less/less.nro
index b077de115c1..c9baf715368 100644
--- a/usr.bin/less/less.nro
+++ b/usr.bin/less/less.nro
@@ -867,15 +867,17 @@ lessopen.sh:
.br
case "$1" in
.br
- *.Z) uncompress -c $1 >/tmp/less.$$ 2>/dev/null
+ *.Z|*.gz) TFILE=`mktemp /tmp/less.XXXXXX` || exit 1
.br
- if [ -s /tmp/less.$$ ]; then
+ gunzip -c $1 >${TFILE} 2>/dev/null
.br
- echo /tmp/less.$$
+ if [ -s ${TFILE} ]; then
+.br
+ echo ${TFILE}
.br
else
.br
- rm -f /tmp/less.$$
+ rm -f ${TFILE}
.br
fi
.br