g_file_copy(): Ensure G_FILE_COPY_OVERWRITE preserves permissions
authorColin Walters <walters@verbum.org>
Sun, 17 Mar 2013 22:33:59 +0000 (18:33 -0400)
committerRyan Lortie <desrt@desrt.ca>
Mon, 25 Mar 2013 20:32:39 +0000 (16:32 -0400)
commit978571d854922d12050e17d618e747ebdb4ff0a8
tree4f979621327c90fccee5dbb36be18a8fa4d3daed
parentef2aa88a4f5febd34e89b0101872d513c78ca7f5
g_file_copy(): Ensure G_FILE_COPY_OVERWRITE preserves permissions

We need to close the stream *before* applying the file modes, because
g_file_replace() allocates a temporary file.  At the moment we're
applying the modes to the extant file, then immediately rename()ing
over it with the default perms.

This regressed with commit 166766a89fcd173dcd6ffda11f902029928f7f28.

The real fix here is to have g_file_create_with_info() so that we can
atomically create a file with the permissions we want.

https://bugzilla.gnome.org/show_bug.cgi?id=696014
gio/gfile.c
gio/tests/file.c