about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2015-01-09 22:37:22 -0800
committerBarton E. Schaefer <schaefer@zsh.org>2015-01-10 10:32:31 -0800
commit199581f7803795a521be0d37c462fd7c3a6506a1 (patch)
tree55f5166b868c4dcb66777dbcd1d2c43a287f1cb6
parentbd13ffefaba033321410f069c6fb32fab1b29fac (diff)
downloadzsh-199581f7803795a521be0d37c462fd7c3a6506a1.tar.gz
zsh-199581f7803795a521be0d37c462fd7c3a6506a1.tar.xz
zsh-199581f7803795a521be0d37c462fd7c3a6506a1.zip
34202: safe tempfile creation part 3 -- use zf_ln instead of mv
-rw-r--r--Completion/Base/Widget/_complete_debug3
-rw-r--r--Completion/compinstall6
-rw-r--r--Functions/Calendar/calendar3
-rw-r--r--Functions/Zftp/zfget_match5
4 files changed, 11 insertions, 6 deletions
diff --git a/Completion/Base/Widget/_complete_debug b/Completion/Base/Widget/_complete_debug
index 50fc8090a..ba3d2b417 100644
--- a/Completion/Base/Widget/_complete_debug
+++ b/Completion/Base/Widget/_complete_debug
@@ -9,7 +9,8 @@ local pager w="${(qq)words}"
 integer debug_fd=-1
 {
   if [[ -t 2 ]]; then
-    mv -f =(<<<'') $tmp &&
+    zmodload -m -F zsh/files b:zf_ln 2>/dev/null &&
+    zf_ln -fn =(<<<'') $tmp &&
     exec {debug_fd}>&2 2>| $tmp
   fi
 
diff --git a/Completion/compinstall b/Completion/compinstall
index ae94993d6..2f99d270d 100644
--- a/Completion/compinstall
+++ b/Completion/compinstall
@@ -3,6 +3,8 @@
 emulate -L zsh
 setopt extendedglob
 
+zmodload -m -F zsh/files b:zf_ln || return 1
+
 local key
 local compcontext=-default-
 
@@ -1958,8 +1960,8 @@ if [[ -z $ifile || -d $ifile ]] ||
 fi
 
 local tmpout=${TMPPREFIX:-/tmp/zsh}compinstall$$
-mv -f =(<<<'') $tmpout &&	# safe tempfile creation
-mv -f =(<<<'') ${tmpout}x || return 1
+zf_ln -fn =(<<<'') $tmpout &&	# safe tempfile creation
+zf_ln -fn =(<<<'') ${tmpout}x || return 1
 
 #
 # Assemble the complete set of lines to
diff --git a/Functions/Calendar/calendar b/Functions/Calendar/calendar
index 39fc4313c..0d651dc10 100644
--- a/Functions/Calendar/calendar
+++ b/Functions/Calendar/calendar
@@ -12,6 +12,7 @@ local -A reply
 
 zmodload -i zsh/datetime || return 1
 zmodload -i zsh/zutil || return 1
+zmodload -m -F zsh/files b:zf_ln || return 1
 
 autoload -Uz calendar_{add,parse,read,scandate,show,lockfiles}
 
@@ -254,7 +255,7 @@ if (( verbose )); then
 fi
 
 local mycmds="${TMPPREFIX:-/tmp/zsh}.calendar_cmds.$$"
-mv -f =(<<<'') $mycmds
+zf_ln -fn =(<<<'') $mycmds || return 1
 
 # start of subshell for OS file locking
 (
diff --git a/Functions/Zftp/zfget_match b/Functions/Zftp/zfget_match
index 3ba06c47a..3f2bbf30c 100644
--- a/Functions/Zftp/zfget_match
+++ b/Functions/Zftp/zfget_match
@@ -1,6 +1,7 @@
 # function zfget_match {
 
 emulate -L zsh
+zmodload -m -F zsh/files b:zf_ln || return 1
 
 # the zfcd hack:  this may not be necessary here
 if [[ $1 == $HOME || $1 == $HOME/* ]]; then
@@ -10,8 +11,8 @@ fi
 if [[ $ZFTP_SYSTEM == UNIX* && $1 == */* ]]; then
   setopt localoptions clobber
   local tmpf=${TMPPREFIX}zfgm$$
-  mv -f =(<<<'') $tmpf
-	
+  zf_ln -fn =(<<<'') $tmpf || return 1
+
   if [[ -n $WIDGET ]]; then
     local dir=${1:h}
     [[ $dir = */ ]] || dir="$dir/"