diff options
author | Eric Andersen <andersen@codepoet.org> | 2004-04-06 12:04:14 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2004-04-06 12:04:14 +0000 |
commit | ba05e79815df6d521c39ce7d2dd7e495ccb6ef48 (patch) | |
tree | c05c52cca51982bc97061056eb8ed1105eca66ee | |
parent | 3f47c453daa4509729fa8a54f58c0291099d01c4 (diff) | |
download | busybox-ba05e79815df6d521c39ce7d2dd7e495ccb6ef48.tar.gz |
Michael Tokarev, mjt at tls dot msk dot ru writes:
Initialize all fields of struct dep_t.
Without that, e.g. `busybox modprobe -v char-major-10-144' *sometimes*
fails this way (strace):
write(1, "insmod nvram `\213\f\10\n", 21) = 21
Note the garbage after module name which is taken from the m_options field,
which is not initialized in the alias reading/parsing part.
(Shell properly complains to this command, telling it can't find the
closing backtick)
-rw-r--r-- | modutils/modprobe.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/modutils/modprobe.c b/modutils/modprobe.c index c6a83553f..2b90eb019 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c @@ -306,10 +306,10 @@ static struct dep_t *build_dep ( void ) // fprintf ( stderr, "ALIAS: '%s' -> '%s'\n", alias, mod ); if ( !current ) { - first = current = (struct dep_t *) xmalloc ( sizeof ( struct dep_t )); + first = current = (struct dep_t *) xcalloc ( 1, sizeof ( struct dep_t )); } else { - current-> m_next = (struct dep_t *) xmalloc ( sizeof ( struct dep_t )); + current-> m_next = (struct dep_t *) xcalloc ( 1, sizeof ( struct dep_t )); current = current-> m_next; } current-> m_module = bb_xstrdup ( alias ); |