summaryrefslogtreecommitdiff
path: root/t/helper/test-drop-caches.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2019-12-09 22:17:55 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-12-09 22:17:55 -0800
commit7034cd094bda4edbcdff7fad1a28fcaaf9b9a040 (patch)
treee0b837c5e5a2ea2fce3255ef59fd981e2bd30374 /t/helper/test-drop-caches.c
parentThe fourth batch (diff)
parentGit 2.24.1 (diff)
downloadtgif-7034cd094bda4edbcdff7fad1a28fcaaf9b9a040.tar.xz
Sync with Git 2.24.1
Diffstat (limited to 't/helper/test-drop-caches.c')
-rw-r--r--t/helper/test-drop-caches.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/t/helper/test-drop-caches.c b/t/helper/test-drop-caches.c
index f65e301f9d..7b4278462b 100644
--- a/t/helper/test-drop-caches.c
+++ b/t/helper/test-drop-caches.c
@@ -8,18 +8,21 @@ static int cmd_sync(void)
{
char Buffer[MAX_PATH];
DWORD dwRet;
- char szVolumeAccessPath[] = "\\\\.\\X:";
+ char szVolumeAccessPath[] = "\\\\.\\XXXX:";
HANDLE hVolWrite;
- int success = 0;
+ int success = 0, dos_drive_prefix;
dwRet = GetCurrentDirectory(MAX_PATH, Buffer);
if ((0 == dwRet) || (dwRet > MAX_PATH))
return error("Error getting current directory");
- if (!has_dos_drive_prefix(Buffer))
+ dos_drive_prefix = has_dos_drive_prefix(Buffer);
+ if (!dos_drive_prefix)
return error("'%s': invalid drive letter", Buffer);
- szVolumeAccessPath[4] = Buffer[0];
+ memcpy(szVolumeAccessPath, Buffer, dos_drive_prefix);
+ szVolumeAccessPath[dos_drive_prefix] = '\0';
+
hVolWrite = CreateFile(szVolumeAccessPath, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (INVALID_HANDLE_VALUE == hVolWrite)