summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1993-12-24 03:12:14 +0000
committerRichard M. Stallman <rms@gnu.org>1993-12-24 03:12:14 +0000
commit4a7e63b938500c1d43e85848f5d5be10ec3bee8c (patch)
tree7b01ee501b1558a5cbe4ba879000905a843af9f9
parent202af1a239aee4af7ac251b2092496184edbcc4c (diff)
downloademacs-4a7e63b938500c1d43e85848f5d5be10ec3bee8c.tar.gz
(vc-mode-line): Make buffer read-only for root if file is locked.
-rw-r--r--lisp/vc-hooks.el7
1 files changed, 7 insertions, 0 deletions
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))