]> rtime.felk.cvut.cz Git - lisovros/iproute2_canprio.git/commit
Prevent renaming interfaces to empty string.
authorPatrick McHardy <kaber@trash.net>
Fri, 12 Oct 2007 12:01:13 +0000 (14:01 +0200)
committerStephen Hemminger <shemminger@linux-foundation.org>
Fri, 12 Oct 2007 22:45:12 +0000 (15:45 -0700)
commitca78b0e7d4042be7f7283d551d433b76da7f312b
treee57472fcdfbe45b26bb6b94399c4e77a2d06c924
parent5058332f3cd751cb0aa4970a0892ebc4b791b748
Prevent renaming interfaces to empty string.

Andreas Henriksson wrote:
> From: Alexander Wirt <formorer@debian.org>
>
>
> Signed-off-by: Andreas Henriksson <andreas@fatal.se>
> ---
>  ip/iplink.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/ip/iplink.c b/ip/iplink.c
> index 4060845..da1f64e 100644
> --- a/ip/iplink.c
> +++ b/ip/iplink.c
> @@ -670,6 +670,10 @@ static int do_set(int argc, char **argv)
>   }
>
>   if (newname && strcmp(dev, newname)) {
> + if (strlen(newname) == 0) {
> +     printf("\"\" is not valid device identifier\n");
> +     return -1;
> + }

Indentation fixed, same change for the non-ioctl case, use invarg.
While I'm at it I also fixed the error message for "name too long",
*argv is NULL at this point.

Signed-off-by: Patrick McHardy <kaber@trash.net>
ip/iplink.c