[PATCH v2] vi: allow writing to another file if this one is readonly

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


Applied, thanks

On Sun, Apr 4, 2021 at 5:30 PM Alison Winters <alisonatwork at outlook.com> wrote:
>
> 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 at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox


More information about the busybox mailing list