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:
Christian Stimming 2006-09-07 10:51:38 +00:00
parent ec4d618240
commit 8da68a09a1

View File

@ -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;