home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 6.0.211 < prev    next >
Encoding:
Internet Message Format  |  2002-02-10  |  2.7 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.0.211
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 6.0.211
  11. Problem:    When reading a file fails, the buffer is empty, but it might still
  12.         be possible to write it with ":w" later.  The original file is
  13.         lost then. (Steve Amerige)
  14. Solution:   Set the 'readonly' option for the buffer.
  15. Files:        src/fileio.c
  16.  
  17.  
  18. *** ../vim60.210/src/fileio.c    Mon Feb 11 13:54:40 2002
  19. --- src/fileio.c    Mon Feb 11 13:46:55 2002
  20. ***************
  21. *** 492,498 ****
  22. --- 496,505 ----
  23.       isdir_f = (mch_isdir(fname));
  24.       perm = mch_getperm(fname);  /* check if the file exists */
  25.       if (isdir_f)
  26. +     {
  27.           filemess(curbuf, sfname, (char_u *)_("is a directory"), 0);
  28. +         curbuf->b_p_ro = TRUE;    /* must use "w!" now */
  29. +     }
  30.       else
  31.   #endif
  32.           if (newfile)
  33. ***************
  34. *** 528,535 ****
  35.               return OK;        /* a new file is not an error */
  36.           }
  37.           else
  38.               filemess(curbuf, sfname,
  39. !                       (char_u *)_("[Permission Denied]"), 0);
  40.           }
  41.   
  42.       return FAIL;
  43. --- 535,545 ----
  44.               return OK;        /* a new file is not an error */
  45.           }
  46.           else
  47. +         {
  48.               filemess(curbuf, sfname,
  49. !                        (char_u *)_("[Permission Denied]"), 0);
  50. !             curbuf->b_p_ro = TRUE;    /* must use "w!" now */
  51. !         }
  52.           }
  53.   
  54.       return FAIL;
  55. ***************
  56. *** 624,629 ****
  57. --- 634,640 ----
  58.           EMSG(_("E200: *ReadPre autocommands made the file unreadable"));
  59.           else
  60.           EMSG(_("E201: *ReadPre autocommands must not change current buffer"));
  61. +         curbuf->b_p_ro = TRUE;    /* must use "w!" now */
  62.           return FAIL;
  63.       }
  64.       }
  65. ***************
  66. *** 1717,1723 ****
  67. --- 1732,1741 ----
  68.       if (got_int)
  69.       {
  70.           if (!(flags & READ_DUMMY))
  71. +         {
  72.           filemess(curbuf, sfname, (char_u *)_(e_interr), 0);
  73. +         curbuf->b_p_ro = TRUE;    /* must use "w!" now */
  74. +         }
  75.           msg_scroll = msg_save;
  76.   #ifdef FEAT_VIMINFO
  77.           check_marks_read();
  78. *** ../vim60.210/src/version.c    Mon Feb 11 13:54:40 2002
  79. --- src/version.c    Mon Feb 11 13:59:45 2002
  80. ***************
  81. *** 608,609 ****
  82. --- 608,611 ----
  83.   {   /* Add new patch number below this line */
  84. + /**/
  85. +     211,
  86.   /**/
  87.  
  88. -- 
  89. ARTHUR:  I did say sorry about the `old woman,' but from the behind you
  90.          looked--
  91. DENNIS:  What I object to is you automatically treat me like an inferior!
  92. ARTHUR:  Well, I AM king...
  93.                                   The Quest for the Holy Grail (Monty Python)
  94.  
  95.  ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
  96. (((   Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim   )))
  97.  \\\  Help me helping AIDS orphans in Uganda - http://iccf-holland.org  ///
  98.