From 486f623b0d4fca79d576a75f82f6f682bb684349 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Tue, 18 Feb 2014 00:05:32 +0100 Subject: [PATCH] Checks for duplicate content file. Thanks Chronial! --- state.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/state.c b/state.c index a8751f35..b564c557 100644 --- a/state.c +++ b/state.c @@ -613,6 +613,19 @@ void state_config(struct snapraid_state* state, const char* path, const char* co /* LCOV_EXCL_STOP */ } + /* check if the content file is already specified */ + for(i=state->contentlist;i!=0;i=i->next) { + content = i->data; + if (pathcmp(content->content, buffer) == 0) + break; + } + if (i) { + /* LCOV_EXCL_START */ + fprintf(stderr, "Duplicate 'content' specification in '%s' at line %u\n", path, line); + exit(EXIT_FAILURE); + /* LCOV_EXCL_STOP */ + } + /* get the device of the directory containing the content file */ pathimport(device, sizeof(device), buffer); slash = strrchr(device, '/');