From e44fa71d25bb0814bd481f88ae15c3acc9c683ce Mon Sep 17 00:00:00 2001 From: Miklos Tirpak Date: Mon, 4 Feb 2008 16:37:55 +0000 Subject: [PATCH] Make a difference between non-existing variable, and not readable variable when the value cannot be retrieved. (reported by Vladimir Marek) --- cfg/cfg_ctx.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cfg/cfg_ctx.c b/cfg/cfg_ctx.c index 38a0b58d16..eac562a256 100644 --- a/cfg/cfg_ctx.c +++ b/cfg/cfg_ctx.c @@ -850,7 +850,12 @@ int cfg_rollback(cfg_ctx_t *ctx) return 0; } -/* returns the value of a variable */ +/* retrieves the value of a variable + * Return value: + * 0 - success + * -1 - error + * 1 - variable exists, but it is not readable + */ int cfg_get_by_name(cfg_ctx_t *ctx, str *group_name, str *var_name, void **val, unsigned int *val_type) { @@ -878,7 +883,7 @@ int cfg_get_by_name(cfg_ctx_t *ctx, str *group_name, str *var_name, /* The variable cannot be retrieved, because the fixup function may have changed it, and it is better to return an error than an incorrect value */ - return -1; + return 1; } /* use the module's handle to access the variable -- 2.20.1