From: Richard M. Stallman Date: Fri, 24 Dec 1993 03:12:14 +0000 (+0000) Subject: (vc-mode-line): Make buffer read-only for root if file is locked. X-Git-Tag: emacs-19.34~10524 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4a7e63b938500c1d43e85848f5d5be10ec3bee8c;p=emacs.git (vc-mode-line): Make buffer read-only for root if file is locked. --- diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el index 283d2bf56eb..8f407d5b9d8 100644 --- a/lisp/vc-hooks.el +++ b/lisp/vc-hooks.el @@ -147,6 +147,13 @@ visiting FILE." (concat " " (or label (symbol-name vc-type)) (if (and vc-rcs-status (eq vc-type 'RCS)) (vc-rcs-status file))))) + ;; Even root shouldn't modify a registered file without locking it first. + (and vc-type + (not buffer-read-only) + (zerop (user-uid)) + (require 'vc) + (not (string-equal (user-login-name) (vc-locking-user file))) + (setq buffer-read-only t)) ;; force update of mode line (set-buffer-modified-p (buffer-modified-p)) vc-type))