[PATCH v2] vi: allow writing to another file if this one is readonly
Alison Winters
alisonatwork at outlook.com
Sun Apr 4 15:30:16 UTC 2021
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.
---
editors/vi.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/editors/vi.c b/editors/vi.c
index 04d584fec..6b877d58a 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -2875,13 +2875,12 @@ static void colon(char *buf)
goto ret;
}
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;
- }
# endif
+ }
//if (useforce) {
// if "fn" is not write-able, chmod u+w
// sprintf(syscmd, "chmod u+w %s", fn);
--
2.30.2
More information about the busybox
mailing list