From db93c4325560c4d8ceeebaa727b9ac5a36096360 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 7 Mar 2012 10:25:26 -0500 Subject: [PATCH] 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 24ec2301..9cc7b823 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 0096f3a6..ff04e8e7 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;