fix behavior of ZZ, with respect to readonly mode(s). original
authorpgf <pgf@69ca8d6d-28ef-0310-b511-8ec308f3f277>
Tue, 28 Mar 2006 14:18:21 +0000 (14:18 +0000)
committerpgf <pgf@69ca8d6d-28ef-0310-b511-8ec308f3f277>
Tue, 28 Mar 2006 14:18:21 +0000 (14:18 +0000)
patch and report from Alexander Griesser.

git-svn-id: svn://busybox.net/trunk/busybox@14679 69ca8d6d-28ef-0310-b511-8ec308f3f277

editors/vi.c

index 1cd1b1a..2852b38 100644 (file)
@@ -3617,12 +3617,13 @@ key_cmd_mode:
                        indicate_error(c);
                        break;
                }
-               if (file_modified
+               if (file_modified) {
 #ifdef CONFIG_FEATURE_VI_READONLY
-                       && ! vi_readonly
-                       && ! readonly
-#endif                                                 /* CONFIG_FEATURE_VI_READONLY */
-                       ) {
+                       if (vi_readonly || readonly) {
+                           psbs("\"%s\" File is read only", cfn);
+                           break;
+                       }
+#endif         /* CONFIG_FEATURE_VI_READONLY */
                        cnt = file_write(cfn, text, end - 1);
                        if (cnt < 0) {
                                if (cnt == -1)