]> git.tue.mpg.de Git - paraslash.git/commitdiff
com_catblob(): Return negative on errors
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 5 Apr 2015 14:43:59 +0000 (14:43 +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 e43d194dd58da5c62ced9f52b65557109c2b081c..5e9fe75553e5a331eeb1d7630e50516c8cfe05fb 100644 (file)
--- 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)