]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
parse_depline may be called from libkmod.c
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Sat, 10 Dec 2011 22:36:22 +0000 (20:36 -0200)
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Sun, 11 Dec 2011 22:58:21 +0000 (20:58 -0200)
allow parse_depline to be called when already initialized as it may be
called from libkmod.c and at that point there is no way to check
mod->init.dep

libkmod/libkmod-module.c

index 24d2f0636fcf47c3df9fbd02206c74631eaa0112..b10d41208419ad66504b3bb2dba1a4883ea4d6d2 100644 (file)
@@ -47,6 +47,7 @@ struct kmod_module {
        char *path;
        struct kmod_list *dep;
        int refcount;
+       int n_dep;
        struct {
                bool dep : 1;
        } init;
@@ -111,7 +112,9 @@ int kmod_module_parse_depline(struct kmod_module *mod, char *line)
        int err, n = 0;
        size_t dirnamelen;
 
-       assert(!mod->init.dep && mod->dep == NULL);
+       if (mod->init.dep)
+               return mod->n_dep;
+       assert(mod->dep == NULL);
        mod->init.dep = true;
 
        p = strchr(line, ':');
@@ -166,6 +169,7 @@ int kmod_module_parse_depline(struct kmod_module *mod, char *line)
        DBG(ctx, "%d dependencies for %s\n", n, mod->name);
 
        mod->dep = list;
+       mod->n_dep = n;
        return n;
 
 fail: