PATCH: removing hardcoded paths from init
Denis Vlasenko
vda.linux at googlemail.com
Sat Jan 20 13:13:40 UTC 2007
On Saturday 20 January 2007 00:19, Gabriel L. Somlo wrote:
> On Thu, Jan 18, 2007 at 01:56:28AM +0100, Denis Vlasenko wrote:
> >
> > FEATURE_EXEC_PREFER_APPLETS is ok I think.
>
> Denis,
>
> Enclosed is the patch that adds FEATURE_EXEC_PREFER_APPLETS to the
> config setup, changes xfuncs.c spawn() to use it instead of
> STANDALONE_SHELL, and makes use of it from init.c to remove hardcoded
> paths.
>
> I'm working on another patch to have a busybox-specific family of exec*p
> routines that use FEATURE_EXEC_PREFER_APPLETS; when that's done, we
> can redo spawn(), init.c, and whatever else we think necessary to just
> call these exec functions instead of the standard library exec
> functions.
>
> Just wanted this patch to get in so I can stop getting 'Bummer,
> couldn't execute /sbin/umount' type error messages from init when I
> don't have the symlinks installed :)
> - execv(cmdpath, cmd);
> + app = ENABLE_FEATURE_EXEC_PREFER_APPLETS ? find_applet_by_name(cmdpath) : NULL;
> + execvp(app ? CONFIG_BUSYBOX_EXEC_PATH : cmdpath, cmd);
Well, it looks strange when you use pointer as a logical yes/no.
- execv(cmdpath, cmd);
+ path = cmdpath;
+ if (ENABLE_FEATURE_EXEC_PREFER_APPLETS && find_applet_by_name(cmdpath))
+ path = CONFIG_BUSYBOX_EXEC_PATH;
+ execvp(path, cmd);
Looks less obfuscated. (Or just reuse cmdpath instead of new 'path' ptr,
if you can).
Can you redo these places like this?
--
vda
More information about the busybox
mailing list