]> pilppa.org Git - libplp.git/blobdiff - src/private/uci_config.c
cleanups for devices with no data
[libplp.git] / src / private / uci_config.c
index 756f2b7bf5ba150db1449976386928e5cf6b751c..765a1be0f111474d4db7a362a4f3221f7343d5a2 100644 (file)
@@ -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;