comparison src/fileio.c @ 2793:ee48b3da9d53 v7.3.172

updated for version 7.3.172 Problem: MS-Windows: rename() might delete the file if the name differs but it's actually the same file. Solution: Use the file handle to check if it's the same file. (Yukihiro Nakadaira)
author Bram Moolenaar <bram@vim.org>
date Thu, 05 May 2011 16:41:24 +0200
parents 25672ad7f377
children 8bd38abda314
comparison
equal deleted inserted replaced
2792:f8a458d9f368 2793:ee48b3da9d53
6553 && st.st_dev == st_to.st_dev 6553 && st.st_dev == st_to.st_dev
6554 && st.st_ino == st_to.st_ino) 6554 && st.st_ino == st_to.st_ino)
6555 use_tmp_file = TRUE; 6555 use_tmp_file = TRUE;
6556 } 6556 }
6557 #endif 6557 #endif
6558 #ifdef WIN3264
6559 {
6560 BY_HANDLE_FILE_INFORMATION info1, info2;
6561
6562 /* It's possible for the source and destination to be the same file.
6563 * In that case go through a temp file name. This makes rename("foo",
6564 * "./foo") a no-op (in a complicated way). */
6565 if (win32_fileinfo(from, &info1) == FILEINFO_OK
6566 && win32_fileinfo(to, &info2) == FILEINFO_OK
6567 && info1.dwVolumeSerialNumber == info2.dwVolumeSerialNumber
6568 && info1.nFileIndexHigh == info2.nFileIndexHigh
6569 && info1.nFileIndexLow == info2.nFileIndexLow)
6570 use_tmp_file = TRUE;
6571 }
6572 #endif
6558 6573
6559 #if defined(UNIX) || defined(CASE_INSENSITIVE_FILENAME) 6574 #if defined(UNIX) || defined(CASE_INSENSITIVE_FILENAME)
6560 if (use_tmp_file) 6575 if (use_tmp_file)
6561 { 6576 {
6562 char tempname[MAXPATHL + 1]; 6577 char tempname[MAXPATHL + 1];