From 200accac63deae99eb9656b26363c85648bd6748 Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Sat, 27 Dec 2014 23:59:29 -0800 Subject: 34067: safe tempfile creation, part 1 --- Functions/Zftp/zfuput | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'Functions/Zftp/zfuput') diff --git a/Functions/Zftp/zfuput b/Functions/Zftp/zfuput index 4e0e42dcd..24a355931 100644 --- a/Functions/Zftp/zfuput +++ b/Functions/Zftp/zfuput @@ -12,7 +12,7 @@ emulate -L zsh [[ $curcontext = :zf* ]] || local curcontext=:zfuput -local loc rem locstats remstats doit tmpfile=${TMPPREFIX}zfuput$$ +local loc rem locstats remstats doit local rstat opt opt_v opt_s integer stat do_close @@ -52,12 +52,13 @@ for rem in $*; do stat=1 continue fi - zftp local $loc >$tmpfile - locstats=($(<$tmpfile)) - zftp remote $rem >$tmpfile - rstat=$? - remstats=($(<$tmpfile)) - rm -f $tmpfile + () { + zftp local $loc >|$1 + locstats=($(<$1)) + zftp remote $rem >|$1 + rstat=$? + remstats=($(<$1)) + } =(: temporary file) if [[ $rstat = 2 ]]; then print "Server does not implement full command set required." 1>&2 return 1 -- cgit 1.4.1