summaryrefslogtreecommitdiff
path: root/src/if_cscope.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2011-05-05 16:41:24 +0200
committerBram Moolenaar <Bram@vim.org>2011-05-05 16:41:24 +0200
commit1c32dff7d6b4cf00d1e63ac79968e9deb8b90e2e (patch)
tree2d78aad10e6cfc81acfcac846501a99d719933d5 /src/if_cscope.c
parent85de20665f3ed48345b79cd0920af41397544141 (diff)
downloadvim-git-1c32dff7d6b4cf00d1e63ac79968e9deb8b90e2e.tar.gz
updated for version 7.3.172v7.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)
Diffstat (limited to 'src/if_cscope.c')
-rw-r--r--src/if_cscope.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/if_cscope.c b/src/if_cscope.c
index 82c517371..a96622684 100644
--- a/src/if_cscope.c
+++ b/src/if_cscope.c
@@ -1412,17 +1412,15 @@ cs_insert_filelist(fname, ppath, flags, sb)
{
short i, j;
#ifndef UNIX
- HANDLE hFile;
BY_HANDLE_FILE_INFORMATION bhfi;
- vim_memset(&bhfi, 0, sizeof(bhfi));
/* On windows 9x GetFileInformationByHandle doesn't work, so skip it */
if (!mch_windows95())
{
- hFile = CreateFile(fname, FILE_READ_ATTRIBUTES, 0, NULL, OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL, NULL);
- if (hFile == INVALID_HANDLE_VALUE)
+ switch (win32_fileinfo(fname, &bhfi))
{
+ case FILEINFO_ENC_FAIL: /* enc_to_utf16() failed */
+ case FILEINFO_READ_FAIL: /* CreateFile() failed */
if (p_csverbose)
{
char *cant_msg = _("E625: cannot open cscope database: %s");
@@ -1438,15 +1436,12 @@ cs_insert_filelist(fname, ppath, flags, sb)
(void)EMSG2(cant_msg, fname);
}
return -1;
- }
- if (!GetFileInformationByHandle(hFile, &bhfi))
- {
- CloseHandle(hFile);
+
+ case FILEINFO_INFO_FAIL: /* GetFileInformationByHandle() failed */
if (p_csverbose)
(void)EMSG(_("E626: cannot get cscope database information"));
return -1;
}
- CloseHandle(hFile);
}
#endif