summaryrefslogtreecommitdiff
path: root/usr.bin/vi/common
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2015-04-19 01:11:00 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2015-04-19 01:11:00 +0000
commit0d908d9d34d85fd542cd10dbf0dd2f4de4474ec9 (patch)
treeebacee457f6cf7be344fcd6fd688af805b0e381f /usr.bin/vi/common
parentfb954fed07fd5c75d1bbae9e78e91bc5862ba742 (diff)
Don't lock the file for "vi -R" or "view". OK deraadt@
Diffstat (limited to 'usr.bin/vi/common')
-rw-r--r--usr.bin/vi/common/exf.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/usr.bin/vi/common/exf.c b/usr.bin/vi/common/exf.c
index 96b7c35ae43..43d14008859 100644
--- a/usr.bin/vi/common/exf.c
+++ b/usr.bin/vi/common/exf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exf.c,v 1.34 2015/03/27 04:11:25 brynet Exp $ */
+/* $OpenBSD: exf.c,v 1.35 2015/04/19 01:10:59 millert Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@@ -333,7 +333,7 @@ file_init(SCR *sp, FREF *frp, char *rcv_name, int flags)
* when locking is a little more reliable, this should change to be
* an error.
*/
- if (rcv_name == NULL)
+ if (rcv_name == NULL && !O_ISSET(sp, O_READONLY))
switch (file_lock(sp, oname,
&ep->fcntl_fd, ep->db->fd(ep->db), 0)) {
case LOCK_FAILED:
@@ -341,10 +341,8 @@ file_init(SCR *sp, FREF *frp, char *rcv_name, int flags)
break;
case LOCK_UNAVAIL:
readonly = 1;
- if (!O_ISSET(sp, O_READONLY)) {
- msgq_str(sp, M_INFO, oname,
- "239|%s already locked, session is read-only");
- }
+ msgq_str(sp, M_INFO, oname,
+ "239|%s already locked, session is read-only");
break;
case LOCK_SUCCESS:
break;