From 1ac3b91158524919e913e1e23c400c1591117a21 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 23 Feb 2014 10:57:04 +0100 Subject: [PATCH 1/1] com_cpsi(): Tell the user if nothing was copied. All but the first argument to the cpsi command are treated as patterns. Currently, if no file matches any given pattern, the command exits silently. This patch makes it print a "nothing copied" message in this case. --- aft.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/aft.c b/aft.c index 179777ba..39f95ad2 100644 --- a/aft.c +++ b/aft.c @@ -2409,13 +2409,12 @@ static void com_cpsi_callback(int fd, const struct osl_object *query) out: if (ret < 0) para_printf(&cad.pb, "%s\n", para_strerror(-ret)); - else if (cad.flags & CPSI_FLAG_VERBOSE) { - if (pmd.num_matches > 0) + else if (pmd.num_matches > 0) { + if (cad.flags & CPSI_FLAG_VERBOSE) para_printf(&cad.pb, "copied requested afsi from %s " "to %u files\n", source_path, pmd.num_matches); - else - para_printf(&cad.pb, "nothing copied\n"); - } + } else + para_printf(&cad.pb, "no matches - nothing copied\n"); if (cad.pb.offset) pass_buffer_as_shm(fd, SBD_OUTPUT, cad.pb.buf, cad.pb.offset); free(cad.pb.buf); -- 2.30.2