aboutsummaryrefslogtreecommitdiff
path: root/src/blocks/fs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/blocks/fs.c')
-rw-r--r--src/blocks/fs.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/blocks/fs.c b/src/blocks/fs.c
index 188f14a..7163cc5 100644
--- a/src/blocks/fs.c
+++ b/src/blocks/fs.c
@@ -110,40 +110,40 @@ static void block_fs_clean(block_t *block)
free(fs->block.text);
}
-static bool block_fs_validate(block_t *block, const block_scheme_t *scheme)
+static int block_fs_validate(block_t *block, const block_scheme_t *scheme)
{
block_fs_t *fs = (block_fs_t *)block;
+ int errors = 0;
if (fs->block.text == NULL) {
log_error("Block '%s' requires key '%s'", block->label, "text");
- return false;
+ errors++;
}
if (!format_init(&fs->format, fs->block.text, '%')) {
log_error("Block '%s' has an invalid format", block->label);
- return false;
- }
-
- int marked = format_remark(&fs->format, block->label, block_fs_options);
- if (marked < 0)
- return false;
+ errors++;
+ } else {
+ int marked = format_remark(&fs->format, block->label, block_fs_options);
+ if (marked < 0)
+ errors += -marked;
- if (marked == 0) {
- log_warn("Block '%s' does not use any fs option", block->label);
+ if (marked == 0) {
+ log_warn("Block '%s' does not use any fs option", block->label);
- block->update_fn = NULL;
- log_debug("Disabled updates for block '%s'", block->label);
- return true;
+ block->update_fn = NULL;
+ log_debug("Disabled updates for block '%s'", block->label);
+ }
}
struct stat sbuf;
if (fs->path == NULL || stat(fs->path, &sbuf) < 0) {
log_trace("Failed to read file '%s': %s", fs->path, strerror(errno));
log_error("Block '%s' was given an invalid path '%s'", block->label, fs->path);
- return false;
+ errors++;
}
- return true;
+ return errors;
}
static const config_entry_t block_fs_entries[] = {
@@ -157,5 +157,4 @@ const block_scheme_t block_fs_scheme = {
.alloc_fn = block_fs_alloc,
.clean_fn = block_fs_clean,
.validate_fn = block_fs_validate,
- .resolve_fn = NULL,
};