comparison src/ex_cmds.c @ 19693:9fbeb3bdf49e v8.2.0403

patch 8.2.0403: when 'buftype' is "nofile" there is no overwrite check Commit: https://github.com/vim/vim/commit/a3a9c8ef697bbf6f640cde99710b6f534f29f77d Author: Bram Moolenaar <Bram@vim.org> Date: Thu Mar 19 12:38:34 2020 +0100 patch 8.2.0403: when 'buftype' is "nofile" there is no overwrite check Problem: When 'buftype' is "nofile" there is no overwrite check. Solution: Also check for existing file when 'buftype' is set. (closes #5807)
author Bram Moolenaar <Bram@vim.org>
date Thu, 19 Mar 2020 12:45:04 +0100
parents 7096af834c42
children 5feb426d2ea1
comparison
equal deleted inserted replaced
19692:95a9cf2b8a40 19693:9fbeb3bdf49e
2072 // buf->ffname) 2072 // buf->ffname)
2073 char_u *ffname, // full path version of fname 2073 char_u *ffname, // full path version of fname
2074 int other) // writing under other name 2074 int other) // writing under other name
2075 { 2075 {
2076 /* 2076 /*
2077 * write to other file or b_flags set or not writing the whole file: 2077 * Write to another file or b_flags set or not writing the whole file:
2078 * overwriting only allowed with '!' 2078 * overwriting only allowed with '!'.
2079 */ 2079 */
2080 if ( (other 2080 if ( (other
2081 || (buf->b_flags & BF_NOTEDITED) 2081 || (buf->b_flags & BF_NOTEDITED)
2082 || ((buf->b_flags & BF_NEW) 2082 || ((buf->b_flags & BF_NEW)
2083 && vim_strchr(p_cpo, CPO_OVERNEW) == NULL) 2083 && vim_strchr(p_cpo, CPO_OVERNEW) == NULL)
2084 || (buf->b_flags & BF_READERR)) 2084 || (buf->b_flags & BF_READERR))
2085 && !p_wa 2085 && !p_wa
2086 #ifdef FEAT_QUICKFIX
2087 && !bt_nofilename(buf)
2088 #endif
2089 && vim_fexists(ffname)) 2086 && vim_fexists(ffname))
2090 { 2087 {
2091 if (!eap->forceit && !eap->append) 2088 if (!eap->forceit && !eap->append)
2092 { 2089 {
2093 #ifdef UNIX 2090 #ifdef UNIX