* lisp/files.el (dir-locals-read-from-file): Check file non-empty

before reading.

Fixes: debbugs:13038
This commit is contained in:
Leo Liu 2012-12-01 23:45:38 +08:00
parent b9cf4db5c9
commit ff3d86d099
2 changed files with 14 additions and 8 deletions

View file

@ -1,3 +1,8 @@
2012-12-01 Leo Liu <sdl.web@gmail.com>
* files.el (dir-locals-read-from-file): Check file non-empty
before reading. (Bug#13038)
2012-11-28 Glenn Morris <rgm@gnu.org>
* jka-cmpr-hook.el (jka-compr-get-compression-info):

View file

@ -3625,14 +3625,15 @@ is found. Returns the new class name."
(condition-case err
(progn
(insert-file-contents file)
(let* ((dir-name (file-name-directory file))
(class-name (intern dir-name))
(variables (let ((read-circle nil))
(read (current-buffer)))))
(dir-locals-set-class-variables class-name variables)
(dir-locals-set-directory-class dir-name class-name
(nth 5 (file-attributes file)))
class-name))
(unless (zerop (buffer-size))
(let* ((dir-name (file-name-directory file))
(class-name (intern dir-name))
(variables (let ((read-circle nil))
(read (current-buffer)))))
(dir-locals-set-class-variables class-name variables)
(dir-locals-set-directory-class dir-name class-name
(nth 5 (file-attributes file)))
class-name)))
(error (message "Error reading dir-locals: %S" err) nil)))))
(defcustom enable-remote-dir-locals nil