From: Andre Noll Date: Sun, 5 Apr 2015 14:43:59 +0000 (+0000) Subject: com_catblob(): Return negative on errors X-Git-Tag: v0.5.6~94^2~13 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=76b2c831235944aa6d08da4f7001bf9214075a4f;p=paraslash.git com_catblob(): Return negative on errors --- 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)