conf: perform aftercheck on ctx-copy
authorDavid Herrmann <dh.herrmann@googlemail.com>
Tue, 5 Feb 2013 10:45:33 +0000 (11:45 +0100)
committerDavid Herrmann <dh.herrmann@googlemail.com>
Tue, 5 Feb 2013 10:45:33 +0000 (11:45 +0100)
Afterchecks should be always performed when reading data into a config
context. So perform them after copy operations, too.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
src/conf.c

index ef65eed..cb4e6bf 100644 (file)
@@ -123,7 +123,7 @@ void *conf_ctx_get_mem(struct conf_ctx *ctx)
 int conf_ctx_parse_ctx(struct conf_ctx *ctx, const struct conf_ctx *src)
 {
        unsigned int i;
-       struct conf_option *d, *s;
+       struct conf_option *d, *s, *o;
        int ret;
 
        if (!ctx || !src)
@@ -154,6 +154,15 @@ int conf_ctx_parse_ctx(struct conf_ctx *ctx, const struct conf_ctx *src)
                }
        }
 
+       for (i = 0; i < ctx->onum; ++i) {
+               o = &ctx->opts[i];
+               if (o->aftercheck) {
+                       ret = o->aftercheck(o, 0, NULL, 0);
+                       if (ret < 0)
+                               return ret;
+               }
+       }
+
        return 0;
 }