X-Git-Url: http://pilppa.org/gitweb/?p=libplp.git;a=blobdiff_plain;f=src%2Fprivate%2Fuci_config.c;fp=src%2Fprivate%2Fuci_config.c;h=765a1be0f111474d4db7a362a4f3221f7343d5a2;hp=756f2b7bf5ba150db1449976386928e5cf6b751c;hb=0fa52fa51ad87bfb7871956f2cca83434f3bff7e;hpb=97671ad08a864c833fab1b3827e3d91749c0e9d7 diff --git a/src/private/uci_config.c b/src/private/uci_config.c index 756f2b7..765a1be 100644 --- a/src/private/uci_config.c +++ b/src/private/uci_config.c @@ -7,6 +7,7 @@ #include "uci_config.h" #include "../log.h" +#include "../retval.h" int uci_create_named_section(struct uci_context *ctx, const char *conf_fname_base, @@ -161,12 +162,14 @@ bool uci_set_config_value(struct uci_context *ctx, char *uci_get_config_value(struct uci_context *ctx, struct uci_package *pkg, const char *section_name, - const char *key_name) { + const char *key_name, + int *err_flg) { struct uci_section *section; struct uci_option *option; char *ret_val; ret_val = NULL; + *err_flg = PLP_OK; if ((ctx != NULL) && (pkg != NULL)) { section = uci_lookup_section(ctx, @@ -184,15 +187,18 @@ char *uci_get_config_value(struct uci_context *ctx, break; default: log_error("Failed to read configuration value for key: %s\n", key_name); + *err_flg = PLP_ERR_IO; break; } } else { - log_error("Failed to find configuration key: %s\n", key_name); + *err_flg = PLP_ERR_DATA_NOT_FOUND; + //log_error("Failed to find configuration key: %s\n", key_name); } } else { - log_error("Failed to find configuration section name: %s\n", section_name); + *err_flg = PLP_ERR_DATA_NOT_FOUND; + //log_error("Failed to find configuration section name: %s\n", section_name); } } return ret_val;