From: Richard M. Stallman Date: Mon, 10 Oct 2005 21:24:29 +0000 (+0000) Subject: (sh-tmp-file): Use mktemp. X-Git-Tag: emacs-pretest-22.0.90~6684 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=17a3b6da975742dfaa02ebd52c031d9972eac2f9;p=emacs.git (sh-tmp-file): Use mktemp. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 83281d5a321..147cf2afa4d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2005-10-10 Emanuele Giaquinta + + * progmodes/sh-script.el (sh-tmp-file): Use mktemp. + 2005-10-10 Karl Chen * jka-cmpr-hook.el (jka-compr-handler): Fix typo in `operations' prop. diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 8af9b637b0b..ee184e42446 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -3392,16 +3392,20 @@ t means to return a list of all possible completions of STRING. "Insert code to setup temporary file handling. See `sh-feature'." (bash sh-append ksh88) (csh (file-name-nondirectory (buffer-file-name)) - "set tmp = /tmp/" str ".$$" \n + "set tmp = `mktemp /tmp/" str ".XXXXXX`" \n "onintr exit" \n _ (and (goto-char (point-max)) (not (bolp)) ?\n) "exit:\n" "rm $tmp* >&/dev/null" > \n) + ;; The change to use mktemp here has not been tested; + ;; I don't know es syntax, so I had to guess. + ;; If you try it, or if you know es syntax and can check it, + ;; please tell me whether it needs any change. --rms. (es (file-name-nondirectory (buffer-file-name)) - > "local( signals = $signals sighup sigint; tmp = /tmp/" str - ".$pid ) {" \n + > "local( signals = $signals sighup sigint; tmp = `mktemp /tmp/" str + ".XXXXXX` ) {" \n > "catch @ e {" \n > "rm $tmp^* >[2]/dev/null" \n "throw $e" \n @@ -3411,11 +3415,15 @@ t means to return a list of all possible completions of STRING. ?\} > \n) (ksh88 sh-modify sh 7 "EXIT") + ;; The change to use mktemp here has not been tested; + ;; I don't know rc syntax, so I had to guess. + ;; If you try it, or if you know rc syntax and can check it, + ;; please tell me whether it needs any change. --rms. (rc (file-name-nondirectory (buffer-file-name)) - > "tmp = /tmp/" str ".$pid" \n + > "tmp = `mktemp /tmp/" str ".XXXXXX`" \n "fn sigexit { rm $tmp^* >[2]/dev/null }" \n) (sh (file-name-nondirectory (buffer-file-name)) - > "TMP=${TMPDIR:-/tmp}/" str ".$$" \n + > "TMP=`mktemp ${TMPDIR:-/tmp}/" str ".XXXXXX`" \n "trap \"rm $TMP* 2>/dev/null\" " ?0 \n))