From: Gustavo Sverzut Barbieri Date: Sat, 10 Dec 2011 22:36:22 +0000 (-0200) Subject: parse_depline may be called from libkmod.c X-Git-Tag: v1~55^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6a534f72c66b489a6dbc71468db9eb609c3c8bb;p=thirdparty%2Fkmod.git parse_depline may be called from libkmod.c 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 --- diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c index 24d2f063..b10d4120 100644 --- a/libkmod/libkmod-module.c +++ b/libkmod/libkmod-module.c @@ -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: