[BusyBox 0001076]: "ip addr del" does not work

Denis Vlasenko vda.linux at googlemail.com
Sun Nov 5 09:24:47 PST 2006


> Index: networking/libiproute/ipaddress.c
> =================================> --- networking/libiproute/ipaddress.c   (revision 16438)
> +++ networking/libiproute/ipaddress.c   (revision 16439)
> @@ -800,7 +800,7 @@
>  int do_ipaddr(int argc, char **argv)
>  {
>         static const char *const commands[] > -               "add", "delete", "list", "show", "lst", "flush", 0
> +               "add", "del", "delete", "list", "show", "lst", "flush", 0
>         };
>  
>         int command_num > [snip rest that introduced another bug, see the link above; The report
> was automatically sent to the busybox-cvs like any other bugtracker note].

"another bug" is that command_num wasn't updated to 3, right?

> "del" and (i suppose) "lst" are superfluous.
>   We are supposed to recognize e.g. "a" "ad" as "add", etc.
>   Adding every possible string strikes me as a very bad idea, size-wise.
> 
> 
> A sane approach is to use
> - if (strcmp(string_array[i], key) = 0) {
> + if (strncmp(string_array[i], key, strlen(key)) = 0) {
> but that did beg the question if we need an indicator to only accept
> exact matches (like the current code) or not (like the strncmp case).
> See earlier discussion in this thread.

Do you like attached patch?
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 8.patch
Type: text/x-diff
Size: 7932 bytes
Desc: not available
Url : http://busybox.net/lists/busybox/attachments/20061105/d8b49e8d/attachment.bin 


More information about the busybox mailing list