[PATCH 3/8] busybox -- SELinux option support for coreutils: ver3

Denis Vlasenko vda.linux at googlemail.com
Thu Mar 8 16:06:16 UTC 2007


On Thursday 08 March 2007 13:36, Bernhard Fischer wrote:
> --- coreutils/libcoreutils/getopt_mk_fifo_nod.c (revision 17961)
> +++ coreutils/libcoreutils/getopt_mk_fifo_nod.c (working copy)
> @@ -30,11 +30,25 @@
>  {
>         mode_t mode = 0666;
>         char *smode = NULL;
> -
> -       getopt32(argc, argv, "m:", &smode);
> -       if(smode) {
> +#if ENABLE_SELINUX
> +       security_context_t scontext;
> +#endif
> +       int opt = 0;
> +       opt = getopt32(argc, argv, "m:" USE_SELINUX("Z:"), &smode USE_SELINUX(,& scontext));
> 
> nah. Setting opt to 0 is superfluous. Smaller if you use the global option_mask32
> instead of opt here?

I typically use local variable 'opt' if I can. Local variables
should be preferred to global data, in my opinion.
For one, compiler can optimize it better.

Only when applet was already using global 'opt' because it was
checking options from functions other than main(), such usage was
coalesced into one golbal variable instead of a dozen.
--
vda



More information about the busybox mailing list