summary refs log tree commit diff
path: root/Functions/Zftp/zftransfer
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2014-12-27 23:59:29 -0800
committerBarton E. Schaefer <schaefer@zsh.org>2014-12-27 23:59:29 -0800
commit200accac63deae99eb9656b26363c85648bd6748 (patch)
treebd0461e34cb47f0f4f26e339efbc5cda479b0c2b /Functions/Zftp/zftransfer
parent1cd802357096b60561b1a50c0c23ab357bbc0de3 (diff)
downloadzsh-200accac63deae99eb9656b26363c85648bd6748.tar.gz
zsh-200accac63deae99eb9656b26363c85648bd6748.tar.xz
zsh-200accac63deae99eb9656b26363c85648bd6748.zip
34067: safe tempfile creation, part 1
Diffstat (limited to 'Functions/Zftp/zftransfer')
-rw-r--r--Functions/Zftp/zftransfer9
1 files changed, 5 insertions, 4 deletions
diff --git a/Functions/Zftp/zftransfer b/Functions/Zftp/zftransfer
index c70bf7248..432e2f584 100644
--- a/Functions/Zftp/zftransfer
+++ b/Functions/Zftp/zftransfer
@@ -43,10 +43,11 @@ zfautocheck || return 1
 local style
 zstyle -s ':zftp:zftransfer' progress style
 if [[ -n $style && $style != none ]]; then
-  local ZFTP_TSIZE array tmpfile=${TMPPREFIX}zft$$
-  zftp remote $file1 >$tmpfile 2>/dev/null
-  array=($(<$tmpfile))
-  rm -f $tmpfile
+  local ZFTP_TSIZE array
+  () {
+    zftp remote $file1 >|$1 2>/dev/null
+    array=($(<$1))
+  } =(: temporary file)
   [[ $#array -eq 2 ]] && ZFTP_TSIZE=$array[1]
 fi