r14811 - gnucash/trunk/src/backend/file - On Windows, before unlink() we need to chmod() the lock file for write access.
Christian Stimming
cstim at cvs.gnucash.org
Thu Sep 7 06:51:40 EDT 2006
Author: cstim
Date: 2006-09-07 06:51:38 -0400 (Thu, 07 Sep 2006)
New Revision: 14811
Trac: http://svn.gnucash.org/trac/changeset/14811
Modified:
gnucash/trunk/src/backend/file/gnc-backend-file.c
Log:
On Windows, before unlink() we need to chmod() the lock file for write access.
Modified: gnucash/trunk/src/backend/file/gnc-backend-file.c
===================================================================
--- gnucash/trunk/src/backend/file/gnc-backend-file.c 2006-09-06 15:49:06 UTC (rev 14810)
+++ gnucash/trunk/src/backend/file/gnc-backend-file.c 2006-09-07 10:51:38 UTC (rev 14811)
@@ -281,8 +281,23 @@
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;
More information about the gnucash-changes
mailing list