]> pilppa.org Git - libplp.git/blobdiff - src/DeviceConfig.cc
cleanups for devices with no data
[libplp.git] / src / DeviceConfig.cc
index 75af9f396579b0adad82b6ce9144120a6c88d473..a25727565de371aceef170389c994c3d5fac2ced 100644 (file)
@@ -16,6 +16,7 @@
 #include "log.h"
 #include "config.h"
 #include "private/uci_config.h"
+#include "retval.h"
 
 using namespace std;
 using namespace plp;
@@ -122,6 +123,7 @@ string DeviceConfig::get_pathless_config_file_name() {
 bool DeviceConfig::get_config_value(string key, string& value) {
        char    *ret;
        bool    ret_val;
+       int     err_flg;
 
        ret_val = false;
        value.clear();
@@ -132,8 +134,10 @@ bool DeviceConfig::get_config_value(string key, string& value) {
                        ret     = uci_get_config_value(uci_handle->_ctx,
                                                uci_handle->_pkg,
                                                DEVICE_CONFIG__SECTION_NAME,
-                                               key.c_str());
-                       if (ret != NULL) {
+                                               key.c_str(),
+                                               &err_flg);
+                       if ((err_flg == PLP_OK) &&
+                           (ret != NULL)) {
                                ret_val = true;
                                value   = ret;
                        }
@@ -216,7 +220,7 @@ ConfigHandle *DeviceConfig::load_device_config(string device_id_param) {
                if (access(fname_full.c_str(), R_OK) == 0) {
                        ctx     = uci_alloc_context();
                        if (ctx != NULL) {
-                               log_debug("configuration file: %s\n", fname_full.c_str());
+                               //log_debug("configuration file: %s\n", fname_full.c_str());
                                uci_set_confdir(ctx, cfg_dir.c_str());
                                err_flg = uci_load(ctx, fname_full.c_str(), &pkg);
                                if (err_flg == UCI_OK) {