From aef11798b0ea54bb2a8dccbfd2a3451ab3a346b7 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Sat, 30 May 2015 13:18:16 +0200 Subject: [PATCH] Clarify why filters could be rejected with a proper message --- cmdline/elem.c | 2 +- cmdline/snapraid.c | 1 + cmdline/state.c | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cmdline/elem.c b/cmdline/elem.c index 304b1f00..7cb270ba 100644 --- a/cmdline/elem.c +++ b/cmdline/elem.c @@ -84,7 +84,7 @@ struct snapraid_filter* filter_alloc_file(int direction, const char* pattern) filter->is_dir = 0; } - /* a slash must be the first char, as we reject PATH/DIR/FILE */ + /* a slash must be the first char, as we don't support PATH/FILE and PATH/DIR/ */ if (filter->pattern[0] != '/') { /* LCOV_EXCL_START */ free(filter); diff --git a/cmdline/snapraid.c b/cmdline/snapraid.c index 9d935812..9d06b3af 100644 --- a/cmdline/snapraid.c +++ b/cmdline/snapraid.c @@ -468,6 +468,7 @@ int main(int argc, char* argv[]) if (!filter) { /* LCOV_EXCL_START */ log_fatal("Invalid filter specification '%s'\n", optarg); + log_fatal("Filters using relative paths are not supported. Ensure to add an initial slash\n"); exit(EXIT_FAILURE); /* LCOV_EXCL_STOP */ } diff --git a/cmdline/state.c b/cmdline/state.c index 58c39741..f0b19a8e 100644 --- a/cmdline/state.c +++ b/cmdline/state.c @@ -886,6 +886,7 @@ void state_config(struct snapraid_state* state, const char* path, const char* co if (!filter) { /* LCOV_EXCL_START */ log_fatal("Invalid 'exclude' specification '%s' in '%s' at line %u\n", buffer, path, line); + log_fatal("Filters using relative paths are not supported. Ensure to add an initial slash\n"); exit(EXIT_FAILURE); /* LCOV_EXCL_STOP */ } @@ -912,6 +913,7 @@ void state_config(struct snapraid_state* state, const char* path, const char* co if (!filter) { /* LCOV_EXCL_START */ log_fatal("Invalid 'include' specification '%s' in '%s' at line %u\n", buffer, path, line); + log_fatal("Filters using relative paths are not supported. Ensure to add an initial slash\n"); exit(EXIT_FAILURE); /* LCOV_EXCL_STOP */ }