Replace g_file_set_contents().
authorDaniel Carl <danielcarl@gmx.de>
Wed, 10 Oct 2018 22:41:02 +0000 (00:41 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Wed, 10 Oct 2018 22:41:02 +0000 (00:41 +0200)
commit674e994d5ae087cae2e23abf8d4bc4842b8a68c2
tree73b2eb65314c1b0a4ea092593071423cd58cd455
parent43a8d1763aec964a8734aad7d688e1a84d02a36a
Replace g_file_set_contents().

The g_file_set_contents performs atomic write to file by creating a
temporary file, writing to it and renaming it. But during the creation
of the temporary file, the mode is set hard to 0666. So our files will
silently always change their mode in case we processed their content.

This patch adds the util_file_set_content() function which follows the
same approach, but allows to set the mode that is used to create the
temporary file. So the file is created with the right permissions.
src/bookmark.c
src/main.c
src/normal.c
src/util.c
src/util.h