Fix compilation of QLockFile on Solaris

flock isn't available but we use fcnlt already (which is the recommended
alternative on Solaris)

Change-Id: I718e59c4804950a26eeb610888e17ce666522dcc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
David Faure 2013-07-16 10:25:00 +02:00 committed by The Qt Project
parent aab50ad061
commit 4315f270e6
1 changed files with 4 additions and 0 deletions

View File

@ -86,8 +86,10 @@ int QLockFilePrivate::checkFcntlWorksAfterFlock()
if (!file.open())
return 0;
const int fd = file.d_func()->engine()->handle();
#if defined(LOCK_EX) && defined(LOCK_NB)
if (flock(fd, LOCK_EX | LOCK_NB) == -1) // other threads, and other processes on a local fs
return 0;
#endif
struct flock flockData;
flockData.l_type = F_WRLCK;
flockData.l_whence = SEEK_SET;
@ -121,8 +123,10 @@ static bool fcntlWorksAfterFlock()
static bool setNativeLocks(int fd)
{
#if defined(LOCK_EX) && defined(LOCK_NB)
if (flock(fd, LOCK_EX | LOCK_NB) == -1) // other threads, and other processes on a local fs
return false;
#endif
struct flock flockData;
flockData.l_type = F_WRLCK;
flockData.l_whence = SEEK_SET;