|
|
@@ -240,6 +240,18 @@ static void print_config_tree(confdb_handle_t handle, hdb_handle_t parent_object
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+static cs_error_t reload_db(confdb_handle_t handle)
|
|
|
+{
|
|
|
+ char error[1024];
|
|
|
+ cs_error_t ret;
|
|
|
+
|
|
|
+ ret = confdb_reload(handle, 0, error, sizeof(error) - 1);
|
|
|
+ if (ret != CONFDB_OK) {
|
|
|
+ fprintf (stderr, "Error reloading DB %d\n", ret);
|
|
|
+ }
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
static int read_in_config_file (char * filename)
|
|
|
{
|
|
|
confdb_handle_t handle;
|
|
|
@@ -310,7 +322,7 @@ static int read_in_config_file (char * filename)
|
|
|
/* write the attribute */
|
|
|
write_key (handle, line);
|
|
|
}
|
|
|
-
|
|
|
+ reload_db(handle);
|
|
|
confdb_finalize (handle);
|
|
|
fclose (fh);
|
|
|
return 0;
|
|
|
@@ -516,7 +528,7 @@ static void write_key(confdb_handle_t handle, char * path_pt)
|
|
|
old_key_value,
|
|
|
old_key_value_len,
|
|
|
key_value,
|
|
|
- strlen(key_value));
|
|
|
+ strlen(key_value)+1);
|
|
|
|
|
|
if (res != CS_OK)
|
|
|
fprintf(stderr, "Failed to replace the key %s=%s. Error %d\n", key_name, key_value, res);
|
|
|
@@ -526,7 +538,7 @@ static void write_key(confdb_handle_t handle, char * path_pt)
|
|
|
obj_handle,
|
|
|
key_name,
|
|
|
key_value,
|
|
|
- strlen(key_value),
|
|
|
+ strlen(key_value)+1,
|
|
|
CONFDB_VALUETYPE_STRING);
|
|
|
if (res != CS_OK)
|
|
|
fprintf(stderr, "Failed to create the key %s=%s. Error %d\n", key_name, key_value, res);
|
|
|
@@ -645,7 +657,7 @@ static void create_object_key(confdb_handle_t handle, char *name_pt)
|
|
|
obj_handle,
|
|
|
key_name,
|
|
|
key_value,
|
|
|
- strlen(key_value),
|
|
|
+ strlen(key_value)+1,
|
|
|
CONFDB_VALUETYPE_STRING);
|
|
|
if (res != CS_OK) {
|
|
|
fprintf(stderr,
|
|
|
@@ -910,6 +922,8 @@ int main (int argc, char *argv[]) {
|
|
|
if (action == ACTION_TRACK) {
|
|
|
listen_for_object_changes(handle);
|
|
|
stop_tracking(handle);
|
|
|
+ } else {
|
|
|
+ reload_db(handle);
|
|
|
}
|
|
|
|
|
|
result = confdb_finalize (handle);
|