PATCH: replacing exec*p with BB_EXEC*P

Bernhard Fischer rep.dot.nop at gmail.com
Sun Feb 4 10:28:53 UTC 2007


On Sun, Feb 04, 2007 at 01:08:05AM +0100, Denis Vlasenko wrote:
>On Sunday 04 February 2007 00:58, Gabriel L. Somlo wrote:
>> Denis & All,
>> 
>> The first part of this patch fixes BB_EXECLP in libbb.h, (it
>> accidentally calls execvp instead of execlp).
>
>Thanks! Consider this already fixed.
>
>> The rest replaces execlp and execvp calls with BB_EXECLP and
>> BB_EXECVP, respectively (except in the shells, where we use
>> STANDALONE_SHELL to accomplish this).
>> 
>> Once this is in, we should be able to remove hardcoded paths from
>> anywhere else they might still be used.
>> 
>> Cheers,
>> Gabriel
>> 
>> diff -NarU5 busybox-svn-17746.orig/include/libbb.h busybox-svn-17746/include/libbb.h
>> --- busybox-svn-17746.orig/include/libbb.h	2007-02-03 18:17:57.000000000 -0500
>> +++ busybox-svn-17746/include/libbb.h	2007-02-03 18:36:09.000000000 -0500
>> @@ -559,11 +559,11 @@
>>  	execvp((find_applet_by_name(prog)) ? CONFIG_BUSYBOX_EXEC_PATH : prog, cmd)
>>  #define BB_EXECLP(prog,cmd,...) \
>>  	execlp((find_applet_by_name(prog)) ? CONFIG_BUSYBOX_EXEC_PATH : prog, cmd, __VA_ARGS__)
>>  #else
>
>Twenty one callsites. Maybe BB_EXECVP should call bb_execvp()
>(which should be a function) to save space?

Yes, please put it into an bb_execvp
>
>>  #define BB_EXECVP(prog,cmd) execvp(prog,cmd)
>> -#define BB_EXECLP(prog,cmd,...) execvp(prog,cmd, __VA_ARGS__) 
>> +#define BB_EXECLP(prog,cmd,...) execlp(prog,cmd, __VA_ARGS__) 
>
>It's probably too messy to make BB_EXECLP a function because of varargs...

Why so? We already have several functions with varargs (our print
helpers), so this is fine. I'll note that several uncommon compilers had
problems with __VA_ARGS__ in the preprocessor but work fine for varargs
for the compiler. I'd prefer to have bb_execlp as a function, too.



More information about the busybox mailing list