mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-12-01 13:09:41 -06:00
Don't chown() the owner,
only root can do that. Ignore errors on chown() since that means the save completed successful anyway. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@12132 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
e16e517092
commit
99dda8e5a8
@ -1,3 +1,9 @@
|
||||
2005-12-05 Christian Stimming <stimming@tuhh.de>
|
||||
|
||||
* src/backend/file/gnc-backend-file.c: Don't chown() the owner,
|
||||
only root can do that. Ignore errors on chown() since that means
|
||||
the save completed successful anyway.
|
||||
|
||||
2005-12-04 Derek Atkins <derek@ihtfp.com>
|
||||
|
||||
* configure.in: fix some of the output strings
|
||||
|
@ -552,23 +552,32 @@ gnc_file_be_write_to_file(FileBackend *fbe,
|
||||
if(chmod(tmp_name, statbuf.st_mode) != 0)
|
||||
{
|
||||
qof_backend_set_error(be, ERR_BACKEND_PERM);
|
||||
/* FIXME: Even if the chmod did fail, the save
|
||||
nevertheless completed successfully. It is
|
||||
therefore wrong to signal the ERR_BACKEND_PERM
|
||||
error here which implies that the saving itself
|
||||
failed! What should we do? */
|
||||
PWARN("unable to chmod filename %s: %s",
|
||||
datafile ? datafile : "(null)",
|
||||
tmp_name ? tmp_name : "(null)",
|
||||
strerror(errno) ? strerror(errno) : "");
|
||||
#if VFAT_DOESNT_SUCK /* chmod always fails on vfat fs */
|
||||
g_free(tmp_name);
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
if(chown(tmp_name, statbuf.st_uid, statbuf.st_gid) != 0)
|
||||
/* Don't try to change the owner. Only root can do
|
||||
that. */
|
||||
if(chown(tmp_name, -1, statbuf.st_gid) != 0)
|
||||
{
|
||||
qof_backend_set_error(be, ERR_BACKEND_PERM);
|
||||
/* qof_backend_set_error(be, ERR_BACKEND_PERM); */
|
||||
/* A failed chown doesn't mean that the saving itself
|
||||
failed. So don't abort with an error here! */
|
||||
PWARN("unable to chown filename %s: %s",
|
||||
datafile ? datafile : "(null)",
|
||||
tmp_name ? tmp_name : "(null)",
|
||||
strerror(errno) ? strerror(errno) : "");
|
||||
#if VFAT_DOESNT_SUCK /* chown always fails on vfat fs */
|
||||
g_free(tmp_name);
|
||||
return FALSE;
|
||||
/* g_free(tmp_name);
|
||||
return FALSE; */
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user