Comment 0 for bug 1021860

Revision history for this message
Sergey "Shnatsel" Davidoff (shnatsel) wrote :

Do not use FileUtils.set_contents() also known as g_file_set_contents() for overwriting files, because it resets file permissions to default permissive policy and can potentially expose files that were made private. GIO function document.file.replace_contents() should be used instead.

See http://valadoc.org/#!api=gio-2.0/GLib.File.replace_contents for documentation. There's also replace_contents_async() which can be useful.
An example of transitioning code to that function can be found in http://bazaar.launchpad.net/~elementary-apps/scratch/scratch/revision/782 in Tab.Vala

I'm marking all projects in which I've grepped this function as affected.