[ostree] pull: Only fetch .archive-content for regular files



commit dee30bda7c677a2d7efc98a2fa4443c8080190be
Author: Colin Walters <walters verbum org>
Date:   Thu Feb 23 12:30:01 2012 -0500

    pull: Only fetch .archive-content for regular files
    
    Otherwise e.g. Apache httpd might try to follow a symbolic link to
    /bin/tinylogin which clearly won't work.

 src/ostree/ostree-pull.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/src/ostree/ostree-pull.c b/src/ostree/ostree-pull.c
index d1553c8..6b954ba 100644
--- a/src/ostree/ostree-pull.c
+++ b/src/ostree/ostree-pull.c
@@ -256,14 +256,6 @@ store_tree_recurse (OstreeRepo   *repo,
                              error))
             goto out;
 
-          g_clear_object (&content_file);
-          if (!fetch_object (repo, soup, base_uri, checksum,
-                             OSTREE_OBJECT_TYPE_ARCHIVED_FILE_CONTENT,
-                             &did_exist,
-                             &content_file,
-                             error))
-            goto out;
-
           if (!ostree_map_metadata_file (meta_file, OSTREE_OBJECT_TYPE_ARCHIVED_FILE_META,
                                          &archive_metadata, error))
             goto out;
@@ -271,8 +263,17 @@ store_tree_recurse (OstreeRepo   *repo,
           if (!ostree_parse_archived_file_meta (archive_metadata, &archive_file_info, &archive_xattrs, error))
             goto out;
 
+          g_clear_object (&input);
+          g_clear_object (&content_file);
           if (g_file_info_get_file_type (archive_file_info) == G_FILE_TYPE_REGULAR)
             {
+              if (!fetch_object (repo, soup, base_uri, checksum,
+                                 OSTREE_OBJECT_TYPE_ARCHIVED_FILE_CONTENT,
+                                 &did_exist,
+                                 &content_file,
+                                 error))
+                goto out;
+              
               input = (GInputStream*)g_file_read (content_file, NULL, error);
               if (!input)
                 goto out;



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