From 89e7929fc017fed9011132b4b640e262bb2accfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=B6hler?= Date: Fri, 26 Jan 2007 22:29:42 +0000 Subject: [PATCH] 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 --- src/backend/file/gnc-backend-file.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/backend/file/gnc-backend-file.c b/src/backend/file/gnc-backend-file.c index 22beae4603..dcc902b824 100644 --- a/src/backend/file/gnc-backend-file.c +++ b/src/backend/file/gnc-backend-file.c @@ -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) : "");