mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
On Windows, before unlink() we need to chmod() the lock file for write access.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@14811 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
ec4d618240
commit
8da68a09a1
@ -281,8 +281,23 @@ file_session_end(QofBackend *be_start)
|
||||
if (be->lockfd > 0)
|
||||
close (be->lockfd);
|
||||
|
||||
if (be->lockfile)
|
||||
unlink (be->lockfile);
|
||||
if (be->lockfile) {
|
||||
int rv;
|
||||
#ifdef G_OS_WIN32
|
||||
/* On windows, we need to allow write-access before
|
||||
unlink() can succeed */
|
||||
rv = chmod (be->lockfile, S_IWRITE | S_IREAD);
|
||||
if (rv) {
|
||||
PWARN("Error on chmod(%s): %d: %s", be->lockfile,
|
||||
errno, strerror(errno) ? strerror(errno) : "");
|
||||
}
|
||||
#endif
|
||||
rv = unlink (be->lockfile);
|
||||
if (rv) {
|
||||
PWARN("Error on unlink(%s): %d: %s", be->lockfile,
|
||||
errno, strerror(errno) ? strerror(errno) : "");
|
||||
}
|
||||
}
|
||||
|
||||
g_free (be->dirname);
|
||||
be->dirname = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user