From 76b2c831235944aa6d08da4f7001bf9214075a4f Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 5 Apr 2015 14:43:59 +0000 Subject: [PATCH] com_catblob(): Return negative on errors --- blob.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/blob.c b/blob.c index e43d194d..5e9fe755 100644 --- a/blob.c +++ b/blob.c @@ -223,6 +223,7 @@ static int cat_blob(struct osl_table *table, struct osl_row *row, static int com_catblob_callback(struct osl_table *table, int fd, const struct osl_object *query) { + int ret; struct pattern_match_data pmd = { .table = table, .patterns = *query, @@ -232,12 +233,12 @@ static int com_catblob_callback(struct osl_table *table, int fd, .data = &fd, .action = cat_blob }; - for_each_matching_row(&pmd); - if (pmd.num_matches == 0) { - char err_msg[] = "no matches\n"; - pass_buffer_as_shm(fd, SBD_OUTPUT, err_msg, sizeof(err_msg)); - } - return 0; + ret = for_each_matching_row(&pmd); + if (ret < 0) + return ret; + if (pmd.num_matches == 0) + ret = -E_NO_MATCH; + return ret; } static int com_catblob(callback_function *f, struct command_context *cc) -- 2.39.2