diff options
author | Barton E. Schaefer <schaefer@zsh.org> | 2014-12-27 23:59:29 -0800 |
---|---|---|
committer | Barton E. Schaefer <schaefer@zsh.org> | 2014-12-27 23:59:29 -0800 |
commit | 200accac63deae99eb9656b26363c85648bd6748 (patch) | |
tree | bd0461e34cb47f0f4f26e339efbc5cda479b0c2b /Functions/Zftp/zfcput | |
parent | 1cd802357096b60561b1a50c0c23ab357bbc0de3 (diff) | |
download | zsh-200accac63deae99eb9656b26363c85648bd6748.tar.gz zsh-200accac63deae99eb9656b26363c85648bd6748.tar.xz zsh-200accac63deae99eb9656b26363c85648bd6748.zip |
34067: safe tempfile creation, part 1
Diffstat (limited to 'Functions/Zftp/zfcput')
-rw-r--r-- | Functions/Zftp/zfcput | 10 |
1 files changed, 5 insertions, 5 deletions
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 |