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
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to