summaryrefslogtreecommitdiff
path: root/src/libotutil/ot-variant-utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libotutil/ot-variant-utils.c')
-rw-r--r--src/libotutil/ot-variant-utils.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libotutil/ot-variant-utils.c b/src/libotutil/ot-variant-utils.c
index 93b69b84..973dbf16 100644
--- a/src/libotutil/ot-variant-utils.c
+++ b/src/libotutil/ot-variant-utils.c
@@ -118,11 +118,16 @@ ot_util_variant_map (GFile *src,
const char *path = NULL;
ot_lvariant GVariant *ret_variant = NULL;
GMappedFile *mfile = NULL;
+ int fd;
path = ot_gfile_get_path_cached (src);
- mfile = g_mapped_file_new (path, FALSE, error);
+ if (!ot_unix_open_noatime (path, &fd, error))
+ goto out;
+ mfile = g_mapped_file_new_from_fd (fd, FALSE, error);
if (!mfile)
goto out;
+ if (!ot_unix_close (fd, error))
+ goto out;
ret_variant = g_variant_new_from_data (type,
g_mapped_file_get_contents (mfile),