From 539462ba5d5e6a5aea5cdc786085d40c4d94abc2 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 5 Apr 2015 14:40:44 +0000 Subject: [PATCH] com_lsblob(): Return negative on errors --- blob.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/blob.c b/blob.c index 5eb125c8..e43d194d 100644 --- a/blob.c +++ b/blob.c @@ -122,7 +122,7 @@ static int print_blob(struct osl_table *table, struct osl_row *row, } ret = osl(osl_get_object(table, row, BLOBCOL_ID, &obj)); if (ret < 0) { - para_printf(&lbad->pb, "%s: %s\n", name, para_strerror(-ret)); + para_printf(&lbad->pb, "cannot list %s\n", name); return ret; } id = *(uint32_t *)obj.data; @@ -163,11 +163,12 @@ static int com_lsblob_callback(struct osl_table *table, pmd.loop_col_num = BLOBCOL_ID; ret = for_each_matching_row(&pmd); if (ret < 0) - para_printf(&lbad.pb, "%s\n", para_strerror(-ret)); - else if (pmd.num_matches == 0 && pmd.patterns.size > 0) - para_printf(&lbad.pb, "no matches\n"); + goto out; + if (pmd.num_matches == 0 && pmd.patterns.size > 0) + ret = -E_NO_MATCH; +out: flush_and_free_pb(&lbad.pb); - return 0; + return ret; } static int com_lsblob(callback_function *f, struct command_context *cc) -- 2.30.2