com_lsblob(): Return negative on errors
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 5 Apr 2015 14:40:44 +0000 (14:40 +0000)
committerAndre Noll <maan@tuebingen.mpg.de>
Wed, 12 Aug 2015 21:23:48 +0000 (23:23 +0200)
blob.c

diff --git a/blob.c b/blob.c
index 5eb125c..e43d194 100644 (file)
--- 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)