[git commit] vi: allow writing to another file if this one is readonly

Denys Vlasenko vda.linux at googlemail.com
Tue Apr 13 17:30:16 UTC 2021


commit: https://git.busybox.net/busybox/commit/?id=7b5cbfd6d624e19ac296089b3d675b20bda429a4
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

Version 2. Same change but rebased after Ron's improvements. Fixes bug
where if you open a read only file, you can't save it as a different
filename.

function                                             old     new   delta
colon                                               3160    3162      +2

Signed-off-by: Alison Winters <alisonatwork at outlook.com>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 editors/vi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/editors/vi.c b/editors/vi.c
index fb46dc381..31b5d3e8a 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -2938,7 +2938,7 @@ static void colon(char *buf)
 			fn = args;
 		}
 # if ENABLE_FEATURE_VI_READONLY
-		if (readonly_mode && !useforce) {
+		else if (readonly_mode && !useforce) {
 			status_line_bold("'%s' is read only", fn);
 			goto ret;
 		}


More information about the busybox-cvs mailing list