mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
xml-backend: Lock file is deleted even if the lock is not acquired
The lock file is set in m_lockfile and then unlinked in session_end even if the lock was not acquired. Clear m_lockfile if locking was not successful.
This commit is contained in:
parent
e4619fdae6
commit
0665208299
@ -641,6 +641,7 @@ GncXmlBackend::get_file_lock ()
|
||||
{
|
||||
/* oops .. file is locked by another user .. */
|
||||
set_error(ERR_BACKEND_LOCKED);
|
||||
m_lockfile.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -664,6 +665,7 @@ GncXmlBackend::get_file_lock ()
|
||||
PWARN ("Unable to create the lockfile %s: %s",
|
||||
m_lockfile.c_str(), strerror(errno));
|
||||
set_error(be_err);
|
||||
m_lockfile.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -713,6 +715,7 @@ GncXmlBackend::get_file_lock ()
|
||||
close (m_lockfd);
|
||||
m_lockfd = -1;
|
||||
g_unlink (m_lockfile.c_str());
|
||||
m_lockfile.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -727,6 +730,7 @@ GncXmlBackend::get_file_lock ()
|
||||
close (m_lockfd);
|
||||
m_lockfd = -1;
|
||||
g_unlink (m_lockfile.c_str());
|
||||
m_lockfile.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -737,6 +741,7 @@ GncXmlBackend::get_file_lock ()
|
||||
close (m_lockfd);
|
||||
m_lockfd = -1;
|
||||
g_unlink (m_lockfile.c_str());
|
||||
m_lockfile.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user