[epiphany] adblock: Clarify the need for G_FILE_CREATE_REPLACE_DESTINATION
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] adblock: Clarify the need for G_FILE_CREATE_REPLACE_DESTINATION
- Date: Mon, 9 Sep 2019 19:23:21 +0000 (UTC)
commit 5adf08469767f8b34345021c3f272d6b33255706
Author: Adrian Perez de Castro <aperez igalia com>
Date: Sun Sep 8 13:35:48 2019 +0300
adblock: Clarify the need for G_FILE_CREATE_REPLACE_DESTINATION
Because it does not hurt to have the explanation in the code for
future reference.
embed/ephy-filters-manager.c | 8 ++++++++
1 file changed, 8 insertions(+)
---
diff --git a/embed/ephy-filters-manager.c b/embed/ephy-filters-manager.c
index 3e9213eaf..f44425402 100644
--- a/embed/ephy-filters-manager.c
+++ b/embed/ephy-filters-manager.c
@@ -335,6 +335,14 @@ filter_info_save_sidecar (FilterInfo *self,
self->checksum,
self->last_update);
+ /* Using G_FILE_CREATE_REPLACE_DESTINATION is needed to ensure that
+ * different processes trying to write the same file replace its
+ * contents atomically so there is no partially written data. If two
+ * processes write the same file, the one which finishes writing later
+ * "wins", but that is fine because both would have downloaded the
+ * same rule set and their metadata files will only have a slightly
+ * different (but very close) timestamp.
+ */
g_file_replace_contents_bytes_async (sidecar_file,
data,
NULL, /* etag */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]