summaryrefslogtreecommitdiff
path: root/runtime/tools/vimspell.sh
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-02-05 21:39:53 +0000
committerBram Moolenaar <Bram@vim.org>2005-02-05 21:39:53 +0000
commit3a7c85bc13c2094042d00eb56ace3445d5dfd5bc (patch)
tree3307cbe01fed7b1ca77f06c82409fd6589eb7b79 /runtime/tools/vimspell.sh
parent8089cae03baf229b28bb850297da874024ca9f26 (diff)
downloadvim-git-3a7c85bc13c2094042d00eb56ace3445d5dfd5bc.tar.gz
updated for version 7.0048
Diffstat (limited to 'runtime/tools/vimspell.sh')
-rwxr-xr-xruntime/tools/vimspell.sh19
1 files changed, 16 insertions, 3 deletions
diff --git a/runtime/tools/vimspell.sh b/runtime/tools/vimspell.sh
index 42072222c..b405b7ad5 100755
--- a/runtime/tools/vimspell.sh
+++ b/runtime/tools/vimspell.sh
@@ -11,11 +11,24 @@
#
# Neil Schemenauer <nascheme@ucalgary.ca>
# March 1999
+#
+# Safe method for the temp file by Javier Fernández-Sanguino_Peña
INFILE=$1
-OUTFILE=/tmp/vimspell.$$
-# if you have "tempfile", use the following line
-#OUTFILE=`tempfile`
+tmp="${TMPDIR-/tmp}"
+OUTFILE=`mktemp -t vimspellXXXXXX || tempfile -p vimspell || echo none`
+# If the standard commands failed then create the file
+# since we cannot create a directory (we cannot remove it on exit)
+# create a file in the safest way possible.
+if test "$OUTFILE" = none; then
+ OUTFILE=$tmp/vimspell$$
+ [ -e $OUTFILE ] && { echo "Cannot use temporary file $OUTFILE, it already exists!; exit 1 ; }
+ (umask 077; touch $OUTFILE)
+fi
+# Note the copy of vimspell cannot be deleted on exit since it is
+# used by vim, otherwise it should do this:
+# trap "rm -f $OUTFILE" 0 1 2 3 9 11 13 15
+
#
# local spellings