summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2013-07-17 22:58:45 -0400
committerColin Walters <walters@verbum.org>2013-07-17 22:59:55 -0400
commit939cd18d39b1abf39543c83c406246b12dbfa03a (patch)
tree26e1b5d5372d5ebb1551aea52d9768cefbc55adf
parentddcaa639e4fa1103cc43318882b447b98890e370 (diff)
downloadlibgsystem-939cd18d39b1abf39543c83c406246b12dbfa03a.tar.gz
fileutils: Override umask for gs_file_create()
The entire point of this API is to atomically create a file with the given mode; we need to fchmod() in order to get exactly what is specified. This fixes gnome-ostree which uses ostree to check out trees; we were losing the g-w bit on checked out files.
-rw-r--r--gsystem-file-utils.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gsystem-file-utils.c b/gsystem-file-utils.c
index cc7fa98..31e7331 100644
--- a/gsystem-file-utils.c
+++ b/gsystem-file-utils.c
@@ -279,6 +279,12 @@ gs_file_create (GFile *file,
_set_error_from_errno (error);
goto out;
}
+
+ if (fchmod (fd, mode) < 0)
+ {
+ _set_error_from_errno (error);
+ goto out;
+ }
ret_stream = g_unix_output_stream_new (fd, TRUE);