To: vim-dev@vim.org Subject: Patch 6.0.266 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.266 Problem: The rename() function deletes the file if the old and the new name are the same. (Volker Kiefel) Solution: Don't do anything if the names are equal. Files: src/fileio.c *** ../vim60.265/src/fileio.c Fri Feb 22 12:33:04 2002 --- src/fileio.c Fri Feb 22 20:26:03 2002 *************** *** 4855,4860 **** --- 4863,4874 ---- #endif /* + * When the names are identical, there is nothing to do. + */ + if (fnamecmp(from, to) == 0) + return 0; + + /* * First delete the "to" file, this is required on some systems to make * the mch_rename() work, on other systems it makes sure that we don't * have two files when the mch_rename() fails. *************** *** 4863,4871 **** #ifdef AMIGA /* * With MSDOS-compatible filesystems (crossdos, messydos) it is possible ! * that the name of the "to" file is the same as the "from" file. To ! * avoid the chance of accidently deleting the "from" file (horror!) we ! * lock it during the remove. * When used for making a backup before writing the file: This should not * happen with ":w", because startscript() should detect this problem and * set buf->b_shortname, causing modname() to return a correct ".bak" file --- 4877,4886 ---- #ifdef AMIGA /* * With MSDOS-compatible filesystems (crossdos, messydos) it is possible ! * that the name of the "to" file is the same as the "from" file, even ! * though the names are different. To avoid the chance of accidently ! * deleting the "from" file (horror!) we lock it during the remove. ! * * When used for making a backup before writing the file: This should not * happen with ":w", because startscript() should detect this problem and * set buf->b_shortname, causing modname() to return a correct ".bak" file *** ../vim60.265/src/version.c Fri Feb 22 20:18:32 2002 --- src/version.c Fri Feb 22 20:29:32 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 266, /**/ -- hundred-and-one symptoms of being an internet addict: 4. Your eyeglasses have a web site burned in on them. /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ /// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\ \\\ Project leader for A-A-P -- http://www.a-a-p.org /// \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///