mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
2002-07-21 Christian Stimming <stimming@tuhh.de>
* src/backend/file/gnc-backend-file.c: File permission fix by Matt Brubeck <mbrubeck@cs.hmc.edu> git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7121 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
d9acfb3341
commit
0ca1681638
@ -1,3 +1,8 @@
|
|||||||
|
2002-07-21 Christian Stimming <stimming@tuhh.de>
|
||||||
|
|
||||||
|
* src/backend/file/gnc-backend-file.c: File permission fix by Matt
|
||||||
|
Brubeck <mbrubeck@cs.hmc.edu>
|
||||||
|
|
||||||
2002-07-11 Derek Atkins <derek@ihtfp.com>
|
2002-07-11 Derek Atkins <derek@ihtfp.com>
|
||||||
|
|
||||||
* change gncEntry->account into gncEntry->invAccount and
|
* change gncEntry->account into gncEntry->invAccount and
|
||||||
|
@ -626,6 +626,8 @@ gnc_file_be_write_to_file(FileBackend *be, gboolean make_backup)
|
|||||||
const gchar *datafile;
|
const gchar *datafile;
|
||||||
char *tmp_name;
|
char *tmp_name;
|
||||||
GNCBook *book;
|
GNCBook *book;
|
||||||
|
struct stat statbuf;
|
||||||
|
int rc;
|
||||||
|
|
||||||
book = gnc_session_get_book (be->session);
|
book = gnc_session_get_book (be->session);
|
||||||
|
|
||||||
@ -651,6 +653,20 @@ gnc_file_be_write_to_file(FileBackend *be, gboolean make_backup)
|
|||||||
|
|
||||||
if(gnc_book_write_to_xml_file_v2(book, tmp_name))
|
if(gnc_book_write_to_xml_file_v2(book, tmp_name))
|
||||||
{
|
{
|
||||||
|
/* Record the file's permissions before unlinking it */
|
||||||
|
rc = stat(datafile, &statbuf);
|
||||||
|
if(rc == 0)
|
||||||
|
{
|
||||||
|
/* Use the permissions from the original data file */
|
||||||
|
if(chmod(tmp_name, statbuf.st_mode) != 0)
|
||||||
|
{
|
||||||
|
PWARN("unable to chmod filename %s: %s",
|
||||||
|
datafile ? datafile : "(null)",
|
||||||
|
strerror(errno) ? strerror(errno) : "");
|
||||||
|
g_free(tmp_name);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
if(unlink(datafile) != 0 && errno != ENOENT)
|
if(unlink(datafile) != 0 && errno != ENOENT)
|
||||||
{
|
{
|
||||||
xaccBackendSetError((Backend*)be, ERR_BACKEND_MISC);
|
xaccBackendSetError((Backend*)be, ERR_BACKEND_MISC);
|
||||||
|
Loading…
Reference in New Issue
Block a user