From 33b395806470eeac408070fec535bfd5efc20a2c Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Sun, 28 Dec 2014 00:49:08 -0800 Subject: 34068: create tempfiles without forking, and safe temp directory creation --- Completion/Unix/Command/_cvs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'Completion/Unix') diff --git a/Completion/Unix/Command/_cvs b/Completion/Unix/Command/_cvs index 3c06e0481..31997ec09 100644 --- a/Completion/Unix/Command/_cvs +++ b/Completion/Unix/Command/_cvs @@ -704,15 +704,18 @@ _cvs_sub_modules() { _cvs_run() { local cvsroot="$1" dir="$2" shift 2 - local d=/tmp/zsh-cvs-work-$$ - mkdir $d >&/dev/null - cd $d - mkdir CVS >&/dev/null + local d=${TMPPREFIX:-/tmp/zsh}-cvs-work-$$ + rm -rf $d + mkdir $d && + ( + chmod 0700 $d && + builtin cd -q $d && + mkdir CVS >&/dev/null || return 1 print -r - "$cvsroot" > CVS/Root print "$dir" > CVS/Repository print D > CVS/Entries CVS_IGNORE_REMOTE_ROOT= cvs "$@" - cd $OLDPWD + ) rm -rf $d } -- cgit 1.4.1