fix behavior of ZZ, with respect to readonly mode(s). original
authorPaul Fox <pgf@brightstareng.com>
Tue, 28 Mar 2006 14:18:21 +0000 (14:18 -0000)
committerPaul Fox <pgf@brightstareng.com>
Tue, 28 Mar 2006 14:18:21 +0000 (14:18 -0000)
patch and report from Alexander Griesser.

editors/vi.c

index 1cd1b1ae986272acc1f9e654895cb7eca7cae3e4..2852b384a32b743e20b708940af0bc4cf9ab196c 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)