Commit ad974e9e authored by Juri Linkov's avatar Juri Linkov
Browse files

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.
parent f7c66b8b
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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment