afs: Make catblob commands print an error if no blob matched.
authorAndre Noll <maan@systemlinux.org>
Wed, 6 Jul 2011 20:32:06 +0000 (22:32 +0200)
committerAndre Noll <maan@systemlinux.org>
Sun, 6 Nov 2011 11:29:13 +0000 (12:29 +0100)
This is straight-forward given the new generic num_matches
counter which was introduced in the previous patch.

blob.c

diff --git a/blob.c b/blob.c
index b3daf5c..21144d8 100644 (file)
--- a/blob.c
+++ b/blob.c
@@ -223,6 +223,10 @@ static void com_catblob_callback(struct osl_table *table, int fd,
                .action = cat_blob
        };
        for_each_matching_row(&pmd);
+       if (pmd.num_matches == 0) {
+               char err_msg[] = "no matches\n";
+               pass_buffer_as_shm(err_msg, sizeof(err_msg), &fd);
+       }
 }
 
 static int com_catblob(callback_function *f, struct stream_cipher_context *scc, int argc,