Make `dired-diff' more safe. (Bug#5225)
* dired-aux.el (dired-diff): Signal an error when `file' equals to `current' or when `file' is a directory of the `current' file.
This commit is contained in:
parent
f7c66b8bf8
commit
ad974e9e13
2 changed files with 15 additions and 1 deletions
|
@ -1,3 +1,10 @@
|
|||
2009-12-17 Juri Linkov <juri@jurta.org>
|
||||
|
||||
Make `dired-diff' more safe. (Bug#5225)
|
||||
|
||||
* dired-aux.el (dired-diff): Signal an error when `file' equals to
|
||||
`current' or when `file' is a directory of the `current' file.
|
||||
|
||||
2009-12-17 Andreas Schwab <schwab@linux-m68k.org>
|
||||
|
||||
* emacs-lisp/autoload.el (batch-update-autoloads): Only exclude
|
||||
|
|
|
@ -90,7 +90,14 @@ which is options for `diff'."
|
|||
(if (stringp diff-switches)
|
||||
diff-switches
|
||||
(mapconcat 'identity diff-switches " ")))))))
|
||||
(diff file (dired-get-filename t) switches))
|
||||
(let ((current (dired-get-filename t)))
|
||||
(when (or (equal (expand-file-name file)
|
||||
(expand-file-name current))
|
||||
(and (file-directory-p file)
|
||||
(equal (expand-file-name current file)
|
||||
(expand-file-name current))))
|
||||
(error "Attempt to compare the file to itself"))
|
||||
(diff file current switches)))
|
||||
|
||||
;;;###autoload
|
||||
(defun dired-backup-diff (&optional switches)
|
||||
|
|
Loading…
Add table
Reference in a new issue