mirror of https://gitee.com/bigwinds/arangodb
fix lockfile handling
This commit is contained in:
parent
66c0385fe0
commit
01b3c8f99b
|
@ -1261,7 +1261,7 @@ int TRI_VerifyLockFile(char const* filename) {
|
||||||
// try to lock pid file
|
// try to lock pid file
|
||||||
int canLock = fcntl(fd, F_SETLK, &lock); // Exclusive (write) lock
|
int canLock = fcntl(fd, F_SETLK, &lock); // Exclusive (write) lock
|
||||||
|
|
||||||
// file was not yet locken; could be locked
|
// file was not yet locked; could be locked
|
||||||
if (canLock == 0) {
|
if (canLock == 0) {
|
||||||
lock.l_type = F_UNLCK;
|
lock.l_type = F_UNLCK;
|
||||||
fcntl(fd, F_GETLK, &lock);
|
fcntl(fd, F_GETLK, &lock);
|
||||||
|
@ -1332,14 +1332,14 @@ int TRI_DestroyLockFile(char const* filename) {
|
||||||
lock.l_len = 0;
|
lock.l_len = 0;
|
||||||
lock.l_type = F_UNLCK;
|
lock.l_type = F_UNLCK;
|
||||||
lock.l_whence = SEEK_SET;
|
lock.l_whence = SEEK_SET;
|
||||||
// relesae the lock
|
// release the lock
|
||||||
int res = fcntl(fd, F_GETLK, &lock);
|
int res = fcntl(fd, F_SETLK, &lock);
|
||||||
TRI_CLOSE(fd);
|
TRI_CLOSE(fd);
|
||||||
|
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
TRI_UnlinkFile(filename);
|
TRI_UnlinkFile(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
// close lock file descriptor
|
// close lock file descriptor
|
||||||
fd = *(int*)TRI_AtVector(&FileDescriptors, n);
|
fd = *(int*)TRI_AtVector(&FileDescriptors, n);
|
||||||
TRI_CLOSE(fd);
|
TRI_CLOSE(fd);
|
||||||
|
|
Loading…
Reference in New Issue