[ostree] admin update-kernel: Ensure initramfs has correct owner/mode



commit 6b868d84d8bd536e8e409b6b51d0376a584b5f85
Author: Colin Walters <walters verbum org>
Date:   Sun Jan 6 06:43:49 2013 -0500

    admin update-kernel: Ensure initramfs has correct owner/mode
    
    It was 0600, and owned by the creating process (in the fuse case,
    non-root!).  We want it 0644/root/root.

 src/libgsystem                              |    2 +-
 src/ostree/ot-admin-builtin-update-kernel.c |   16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/src/libgsystem b/src/libgsystem
index b4e8a2a..fe898ee 160000
--- a/src/libgsystem
+++ b/src/libgsystem
@@ -1 +1 @@
-Subproject commit b4e8a2ae8684fab55efe74a7fd4b872c934475fd
+Subproject commit fe898ee93bdc8a625c460876c8b49428c8977219
diff --git a/src/ostree/ot-admin-builtin-update-kernel.c b/src/ostree/ot-admin-builtin-update-kernel.c
index 8e57709..199110b 100644
--- a/src/ostree/ot-admin-builtin-update-kernel.c
+++ b/src/ostree/ot-admin-builtin-update-kernel.c
@@ -256,8 +256,24 @@ update_initramfs (OtAdminUpdateKernel  *self,
           goto out;
         }
 
+      if (!gs_file_chmod (initramfs_tmp_file, 0644, cancellable, error))
+        {
+          g_prefix_error (error, "Failed to chmod initramfs: ");
+          goto out;
+        }
+
       if (!gs_file_linkcopy_sync_data (initramfs_tmp_file, initramfs_file, cancellable, error))
         goto out;
+      
+      /* In the fuse case, we need to chown after copying */
+      if (getuid () != 0)
+        {
+          if (!gs_file_chown (initramfs_file, 0, 0, cancellable, error))
+            {
+              g_prefix_error (error, "Failed to chown initramfs: ");
+              goto out;
+            }
+        }
           
       g_print ("Created: %s\n", gs_file_get_path_cached (initramfs_file));
 



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