summaryrefslogtreecommitdiff
path: root/src/bookmark.c
diff options
context:
space:
mode:
authorDaniel Carl <danielcarl@gmx.de>2018-10-11 00:41:02 +0200
committerDaniel Carl <danielcarl@gmx.de>2018-10-11 00:41:02 +0200
commit674e994d5ae087cae2e23abf8d4bc4842b8a68c2 (patch)
tree73b2eb65314c1b0a4ea092593071423cd58cd455 /src/bookmark.c
parent43a8d1763aec964a8734aad7d688e1a84d02a36a (diff)
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.
Diffstat (limited to 'src/bookmark.c')
-rw-r--r--src/bookmark.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bookmark.c b/src/bookmark.c
index 65c3158..4cc6bd7 100644
--- a/src/bookmark.c
+++ b/src/bookmark.c
@@ -90,7 +90,7 @@ gboolean bookmark_remove(const char *uri)
g_string_append_printf(new, "%s\n", line);
}
g_strfreev(lines);
- g_file_set_contents(vb.files[FILES_BOOKMARK], new->str, -1, NULL);
+ util_file_set_content(vb.files[FILES_BOOKMARK], new->str, 0600);
g_string_free(new, TRUE);
}
@@ -217,7 +217,7 @@ gboolean bookmark_queue_unshift(const char *uri)
*/
char *bookmark_queue_pop(int *item_count)
{
- return util_file_pop_line(vb.files[FILES_QUEUE], item_count);
+ return util_file_pop_line(vb.files[FILES_QUEUE], item_count, 0600);
}
/**