interface-file: let commands initialize the interface collection themselves
This commit is contained in:
parent
b57aba1a97
commit
df9c0284b1
3 changed files with 4 additions and 2 deletions
|
@ -275,6 +275,8 @@ ifquery_main(int argc, char *argv[])
|
|||
struct lif_dict state = {};
|
||||
struct lif_dict collection = {};
|
||||
|
||||
lif_interface_collection_init(&collection);
|
||||
|
||||
if (!lif_state_read_path(&state, exec_opts.state_file))
|
||||
{
|
||||
fprintf(stderr, "%s: could not parse %s\n", argv0, exec_opts.state_file);
|
||||
|
|
|
@ -163,6 +163,8 @@ ifupdown_main(int argc, char *argv[])
|
|||
struct lif_dict state = {};
|
||||
struct lif_dict collection = {};
|
||||
|
||||
lif_interface_collection_init(&collection);
|
||||
|
||||
if (!lif_state_read_path(&state, exec_opts.state_file))
|
||||
{
|
||||
fprintf(stderr, "%s: could not parse %s\n", argv0, exec_opts.state_file);
|
||||
|
|
|
@ -117,8 +117,6 @@ keyword_cmp(const void *a, const void *b)
|
|||
bool
|
||||
lif_interface_file_parse(struct lif_dict *collection, const char *filename)
|
||||
{
|
||||
lif_interface_collection_init(collection);
|
||||
|
||||
FILE *f = fopen(filename, "r");
|
||||
if (f == NULL)
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue