[ostree] core: Fix "cat" crashing when it should have returned ENOENT



commit db93c4325560c4d8ceeebaa727b9ac5a36096360
Author: Colin Walters <walters verbum org>
Date:   Wed Mar 7 10:25:26 2012 -0500

    core: Fix "cat" crashing when it should have returned ENOENT

 src/libostree/ostree-repo-file.c |    3 +++
 src/ostree/ot-builtin-cat.c      |    3 ---
 2 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/libostree/ostree-repo-file.c b/src/libostree/ostree-repo-file.c
index 24ec230..9cc7b82 100644
--- a/src/libostree/ostree-repo-file.c
+++ b/src/libostree/ostree-repo-file.c
@@ -992,6 +992,9 @@ ostree_repo_file_read (GFile         *file,
   OstreeRepoFile *self = OSTREE_REPO_FILE (file);
   const char *checksum;
 
+  if (!ostree_repo_file_ensure_resolved (self, error))
+    goto out;
+
   if (self->tree_contents)
     {
       g_set_error_literal (error, G_IO_ERROR,
diff --git a/src/ostree/ot-builtin-cat.c b/src/ostree/ot-builtin-cat.c
index 0096f3a..ff04e8e 100644
--- a/src/ostree/ot-builtin-cat.c
+++ b/src/ostree/ot-builtin-cat.c
@@ -41,9 +41,6 @@ cat_one_file (GFile         *f,
   gboolean ret = FALSE;
   GInputStream *in = NULL;
   
-  if (!ostree_repo_file_ensure_resolved ((OstreeRepoFile*)f, NULL))
-    g_assert_not_reached ();
-
   in = (GInputStream*)g_file_read (f, cancellable, error);
   if (!in)
     goto out;



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