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/zfcput | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Functions/Zftp/zfcput') diff --git a/Functions/Zftp/zfcput b/Functions/Zftp/zfcput index 85141b68d..2cf8fe2d2 100644 --- a/Functions/Zftp/zfcput +++ b/Functions/Zftp/zfcput @@ -14,7 +14,6 @@ emulate -L zsh [[ $curcontext = :zf* ]] || local curcontext=:zfcput local loc rem stat=0 locst remst offs tailtype -local tmpfile=${TMPPREFIX}zfcget$$ rstat # find how tail works. this is intensely annoying, since it's completely # standard in C. od's no use, since we can only skip whole blocks. @@ -40,10 +39,11 @@ for loc in $*; do else # Compare the sizes. locst=($(zftp local $loc)) - zftp remote $rem >$tmpfile - rstat=$? - remst=($(<$tmpfile)) - rm -f $tmpfile + () { + zftp remote $rem >|$1 + rstat=$? + remst=($(<$1)) + } =(: temporary file) if [[ $rstat = 2 ]]; then print "Server does not support remote status commands.\n" \ "You will have to find out the size by hand and use zftp append." 2>&1 -- cgit 1.4.1