summaryrefslogtreecommitdiff
path: root/library/dir_lock.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:13:35 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:13:35 +0200
commit801e8b43b13f1cb67d9e9ba4aae5acb274ccdfbc (patch)
tree473f4a9ea5016f146fb2ff6085807bc91a84c84e /library/dir_lock.cpp
parent3.20 (diff)
downloadFreeFileSync-801e8b43b13f1cb67d9e9ba4aae5acb274ccdfbc.tar.gz
FreeFileSync-801e8b43b13f1cb67d9e9ba4aae5acb274ccdfbc.tar.bz2
FreeFileSync-801e8b43b13f1cb67d9e9ba4aae5acb274ccdfbc.zip
3.21
Diffstat (limited to 'library/dir_lock.cpp')
-rw-r--r--library/dir_lock.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/library/dir_lock.cpp b/library/dir_lock.cpp
index 6123449b..f653fa7c 100644
--- a/library/dir_lock.cpp
+++ b/library/dir_lock.cpp
@@ -473,7 +473,7 @@ bool tryLock(const Zstring& lockfilename) //throw (FileError)
Loki::ScopeGuard guardLockFile = Loki::MakeGuard(::releaseLock, lockfilename);
- //write UUID at the beginning of the file: this ID is a universal identifier for this lock (no matter what the path is, considering symlinks ,etc.)
+ //write UUID at the beginning of the file: this ID is a universal identifier for this lock (no matter what the path is, considering symlinks, etc.)
writeLockInfo(lockfilename); //throw (FileError)
guardLockFile.Dismiss(); //lockfile created successfully
@@ -491,7 +491,7 @@ public:
while (!::tryLock(lockfilename)) //throw (FileError)
::waitOnDirLock(lockfilename, callback); //
- threadObj = std::move(boost::thread(LifeSigns(lockfilename)));
+ threadObj = boost::thread(LifeSigns(lockfilename));
}
~SharedDirLock()
@@ -579,5 +579,19 @@ private:
};
-DirLock::DirLock(const Zstring& lockfilename, DirLockCallback* callback) : //throw (FileError)
- sharedLock(LockAdmin::instance().retrieve(lockfilename, callback)) {}
+DirLock::DirLock(const Zstring& lockfilename, DirLockCallback* callback) //throw (FileError)
+{
+#ifdef FFS_WIN
+ std::vector<wchar_t> volName(std::max(lockfilename.size(), static_cast<size_t>(10000)));
+ if (::GetVolumePathName(lockfilename.c_str(), //__in LPCTSTR lpszFileName,
+ &volName[0], //__out LPTSTR lpszVolumePathName,
+ static_cast<DWORD>(volName.size()))) //__in DWORD cchBufferLength
+ {
+ DWORD dt = ::GetDriveType(&volName[0]);
+ if (dt == DRIVE_CDROM)
+ return; //we don't need a lock for a CD ROM
+ }
+#endif
+
+ sharedLock = LockAdmin::instance().retrieve(lockfilename, callback);
+}
bgstack15