blockdev applet proposal

Denys Vlasenko vda.linux at googlemail.com
Mon Sep 6 14:32:08 UTC 2010


On Mon, Sep 6, 2010 at 4:19 PM, Sergey Naumov <sknaumov at gmail.com> wrote:
>> Please review attached version.
> All works fine except I can pass additional (3-rd) parameter at the
> end of commands which do not require an argument,
> for example ./busybox blockdev --rereadpt /dev/sda a.
> It could save some size, but original utility accepts blockdev
> --rereadpt /dev/sda /dev/sdb, so, from my point of view, we should
> inform user when he tries to provide such an input.
> So, I think, we should add
>
>   if (bdcmd->flags & FL_USRARG)
>       llu = xatoi_positive(*++argv);
> + else
> +     if (argc > 3) bb_show_usage();

This is smaller:

-       if (!*++argv)
+       if (!*++argv || argv[1])
                bb_show_usage();

Fixed in git, thanks!
-- 
vda


More information about the busybox mailing list