Use CREATE_ALWAYS instead of CREATE_NEW

This commit is contained in:
云风
2018-11-14 10:39:38 +08:00
committed by Hisham Muhammad
parent 6048863a96
commit a5336d294d

View File

@@ -382,7 +382,7 @@ static int lfs_lock_dir(lua_State *L) {
lua_pushnil(L); lua_pushstring(L, strerror(errno)); return 2; lua_pushnil(L); lua_pushstring(L, strerror(errno)); return 2;
} }
strcpy(ln, path); strcat(ln, lockfile); strcpy(ln, path); strcat(ln, lockfile);
fd = CreateFile(ln, GENERIC_WRITE, 0, NULL, CREATE_NEW, fd = CreateFile(ln, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE, NULL); FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE, NULL);
free(ln); free(ln);
if(fd == INVALID_HANDLE_VALUE) { if(fd == INVALID_HANDLE_VALUE) {