From a55f7a5212172ad1612bd1b1f0112210ad0785d2 Mon Sep 17 00:00:00 2001 From: Adrian Kepka Date: Sun, 1 May 2022 22:29:50 +0200 Subject: [PATCH] Create temporary file safely using mktemp fix #81 --- bin/run | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/bin/run b/bin/run index 10e25cc..1785631 100755 --- a/bin/run +++ b/bin/run @@ -36,8 +36,7 @@ done ### AW_PATH=$HOME/.vim-anywhere -TMPFILE_DIR=/tmp/vim-anywhere -TMPFILE=$TMPFILE_DIR/doc-$(date +"%y%m%d%H%M%S") +TMPFILE=$(mktemp) VIM_OPTS="--nofork +star" # Use ~/.gvimrc.min or ~/.vimrc.min if one exists @@ -50,9 +49,6 @@ for vimrc_path in "${VIMRC_PATH[@]}"; do fi done -mkdir -p $TMPFILE_DIR -touch $TMPFILE - # Linux if [[ $OSTYPE == "linux-gnu" ]]; then chmod o-r $TMPFILE # Make file only readable by you @@ -82,3 +78,5 @@ elif [[ $OSTYPE == "darwin"* ]]; then LANG=en_US.UTF-8 tr -d '\n' < $TMPFILE | pbcopy osascript -e "activate application \"$app\"" fi + +rm $TMPFILE