From 199581f7803795a521be0d37c462fd7c3a6506a1 Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Fri, 9 Jan 2015 22:37:22 -0800 Subject: 34202: safe tempfile creation part 3 -- use zf_ln instead of mv --- Completion/Base/Widget/_complete_debug | 3 ++- Completion/compinstall | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'Completion') 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 -- cgit 1.4.1