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.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15429 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Andreas Köhler
2007-01-26 22:29:42 +00:00
parent af04e4cd25
commit 89e7929fc0

View File

@@ -288,7 +288,13 @@ file_session_end(QofBackend *be_start)
#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) : "");