[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#652672: busybox: modprobe does not handle builtins



On Sat, 2012-08-11 at 14:02 +0400, Michael Tokarev wrote:
> [Note: the right bug# for this is #652672]
> 
> On 22.07.2012 20:02, Ben Hutchings wrote:
> > OK, attaching a new patch that does that as well.
> 
> > @@ -595,6 +598,11 @@ int modprobe_main(int argc UNUSED_PARAM,
> >  		while (config_read(parser, &s, 1, 1, "# \t", PARSE_NORMAL & ~PARSE_GREEDY))
> >  			get_or_add_modentry(s)->flags |= MODULE_FLAG_LOADED;
> >  		config_close(parser);
> > +
> > +		parser = config_open2("modules.builtin", fopen_for_read);
> > +		while (config_read(parser, &s, 1, 1, "# \t", PARSE_NORMAL))
> > +			get_or_add_modentry(s)->flags |= MODULE_FLAG_BUILTIN;
> > +		config_close(parser);
> >  	}
> >
> >  	if (opt & (OPT_INSERT_ALL | OPT_REMOVE)) {
> 
> This piece should check if modules.builtin has been opened successfully,
> or else `parser' variable will be NULL.

The preceding loop that reads /proc/modules doesn't check this, so
neither did I.  Looking at the source of config_read() and
config_close(), it's clear that this is harmless.

> 		parser = config_open2("modules.builtin", fopen_for_read);
> 		if (parser) {
> 			while (config_read(parser, &s, 1, 1, "# \t", PARSE_NORMAL))
> 				get_or_add_modentry(s)->flags |= MODULE_FLAG_BUILTIN;
> 			config_close(parser);
> 		}
> 
> This is quite a trivial change, is that okay to do this modification
> yet retain your S-o-b line (and change the bug# as well)?
> 
> I want to include this patch with the next revision of busybox,
> and sent it upstream.

Feel free to fix the bug number, of course.

Ben.

-- 
Ben Hutchings
Unix is many things to many people,
but it's never been everything to anybody.

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: