r15429 - gnucash/trunk/src/backend/file - Replace chmod by _wchmod on Windows.

Andreas Köhler andi5 at cvs.gnucash.org
Fri Jan 26 17:29:44 EST 2007


Author: andi5
Date: 2007-01-26 17:29:42 -0500 (Fri, 26 Jan 2007)
New Revision: 15429
Trac: http://svn.gnucash.org/trac/changeset/15429

Modified:
   gnucash/trunk/src/backend/file/gnc-backend-file.c
Log:
Replace chmod by _wchmod on Windows.

To unlink the lock file we need write-access on it. As g_chmod is new in
GLib 2.8, use _wchmod directly.


Modified: gnucash/trunk/src/backend/file/gnc-backend-file.c
===================================================================
--- gnucash/trunk/src/backend/file/gnc-backend-file.c	2007-01-25 22:14:14 UTC (rev 15428)
+++ gnucash/trunk/src/backend/file/gnc-backend-file.c	2007-01-26 22:29:42 UTC (rev 15429)
@@ -288,7 +288,13 @@
 #ifdef G_OS_WIN32
 	/* On windows, we need to allow write-access before
 	   g_unlink() can succeed */
-	rv = chmod (be->lockfile, S_IWRITE | S_IREAD);
+	wchar_t *wlock = g_utf8_to_utf16 (be->lockfile, -1, NULL, NULL, NULL);
+	if (wlock) {
+	    rv = _wchmod (wlock, _S_IWRITE);
+	} else {
+	    errno = EINVAL;
+	    rv = 1;
+	}
 	if (rv) {
 	    PWARN("Error on chmod(%s): %d: %s", be->lockfile,
 		  errno, strerror(errno) ? strerror(errno) : "");



More information about the gnucash-changes mailing list