- // couldn't lock: this might have happened because of a race
- // condition: maybe another instance opened and locked the file
- // between our calls to open() and flock()
- close(m_fdLock);
- m_fdLock = -1;
+ if ( rc != EACCES && rc != EAGAIN )
+ {
+ wxLogSysError(_("Failed to lock the lock file '%s'"),
+ m_nameLock.c_str());
+
+ unlink(m_nameLock);
+
+ return LOCK_ERROR;
+ }
+ //else: couldn't lock because the lock is held by another process:
+ // this might have happened because of a race condition:
+ // maybe another instance opened and locked the file between
+ // our calls to open() and flock(), so don't give an error
+ }