From a5336d294d27f98c38394b6ea441e68bab96bdc8 Mon Sep 17 00:00:00 2001 From: 云风 Date: Wed, 14 Nov 2018 10:39:38 +0800 Subject: Use CREATE_ALWAYS instead of CREATE_NEW --- src/lfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lfs.c b/src/lfs.c index 5ba2df9..cc9d1cd 100644 --- a/src/lfs.c +++ b/src/lfs.c @@ -382,7 +382,7 @@ static int lfs_lock_dir(lua_State *L) { lua_pushnil(L); lua_pushstring(L, strerror(errno)); return 2; } 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); free(ln); if(fd == INVALID_HANDLE_VALUE) { -- cgit v1.2.3-55-g6feb