[libgsystem] fileutils: Override umask for gs_file_create()



commit 939cd18d39b1abf39543c83c406246b12dbfa03a
Author: Colin Walters <walters verbum org>
Date:   Wed Jul 17 22:58:45 2013 -0400

    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.

 gsystem-file-utils.c |    6 ++++++
 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);
   


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]