Skip to content

Commit 4459fbe

Browse files
author
norberttakacs
committed
persist-tool: fix the 'add' function
Signed-off-by: norberttakacs <norbert.takacs@balabit.com>
1 parent 743b258 commit 4459fbe

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

persist-tool/add.c

+23
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,26 @@ add_entry_to_persist_file(gchar *entry, PersistTool *self)
137137
return result;
138138
}
139139

140+
static void
141+
lookup_entry(gpointer data, gpointer user_data)
142+
{
143+
144+
PersistTool *self = (PersistTool *)user_data;
145+
gchar *name = (gchar *)data;
146+
147+
gsize value_len = 0;
148+
guint8 version = 0;
149+
persist_state_lookup_entry(self->state, name, &value_len, &version);
150+
}
151+
152+
/* this function reads all entries in persist to update the in_use struct memeber */
153+
static void
154+
dump_all_entries(PersistTool *self)
155+
{
156+
GList *keys = persist_state_get_key_list(self->state);
157+
g_list_foreach(keys, lookup_entry, self);
158+
g_list_free(keys);
159+
}
140160

141161
gint
142162
add_main(int argc, char *argv[])
@@ -193,6 +213,9 @@ add_main(int argc, char *argv[])
193213
}
194214
}
195215
g_free(line);
216+
217+
dump_all_entries(self);
218+
196219
persist_tool_free(self);
197220
if (input_file != stdin)
198221
{

0 commit comments

Comments
 (0)