[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [PATCH v2] vi: allow writing to another file if this one is readonly
From:       Alison Winters <alisonatwork () outlook ! com>
Date:       2021-04-04 15:30:16
Message-ID: VI1PR0102MB35365E37EFB307C16C431F4ADE789 () VI1PR0102MB3536 ! eurprd01 ! prod ! exchangelabs ! com
[Download RAW message or body]

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
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic