mirror of https://gitee.com/bigwinds/arangodb
System error messages for lock-files in windows.
This commit is contained in:
parent
4c359f98f0
commit
ccf795a303
|
@ -1140,6 +1140,7 @@ char* TRI_SlurpFile (TRI_memory_zone_t* zone,
|
|||
#ifdef TRI_HAVE_WIN32_FILE_LOCKING
|
||||
|
||||
int TRI_CreateLockFile (char const* filename) {
|
||||
TRI_ERRORBUF;
|
||||
BOOL r;
|
||||
DWORD len;
|
||||
HANDLE fd;
|
||||
|
@ -1158,6 +1159,8 @@ int TRI_CreateLockFile (char const* filename) {
|
|||
fd = CreateFile(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
|
||||
if (fd == INVALID_HANDLE_VALUE) {
|
||||
TRI_SYSTEM_ERROR();
|
||||
LOG_ERROR("cannot create Lockfile '%s': %s", filename, TRI_GET_ERRORBUF);
|
||||
return TRI_set_errno(TRI_ERROR_SYS_ERROR);
|
||||
}
|
||||
|
||||
|
@ -1167,6 +1170,8 @@ int TRI_CreateLockFile (char const* filename) {
|
|||
r = WriteFile(fd, buf, (unsigned int) strlen(buf), &len, NULL);
|
||||
|
||||
if (! r || len != strlen(buf)) {
|
||||
TRI_SYSTEM_ERROR();
|
||||
LOG_ERROR("cannot write Lockfile '%s': %s", filename, TRI_GET_ERRORBUF);
|
||||
res = TRI_set_errno(TRI_ERROR_SYS_ERROR);
|
||||
|
||||
TRI_FreeString(TRI_CORE_MEM_ZONE, buf);
|
||||
|
@ -1186,6 +1191,8 @@ int TRI_CreateLockFile (char const* filename) {
|
|||
r = LockFileEx(fd, LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY, 0, 0, 128, &ol);
|
||||
|
||||
if (! r) {
|
||||
TRI_SYSTEM_ERROR();
|
||||
LOG_ERROR("cannot set Lockfile status '%s': %s", filename, TRI_GET_ERRORBUF);
|
||||
res = TRI_set_errno(TRI_ERROR_SYS_ERROR);
|
||||
|
||||
CloseHandle(fd);
|
||||
|
|
Loading…
Reference in New Issue