netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Andreas Henriksson <andreas@fatal.se>
Cc: shemminger@linux-foundation.org, netdev@vger.kernel.org,
	Alexander Wirt <formorer@debian.org>
Subject: Re: [PATCH 03/12] Prevent renaming interfaces to empty string.
Date: Fri, 12 Oct 2007 14:01:13 +0200	[thread overview]
Message-ID: <470F6209.6020708@trash.net> (raw)
In-Reply-To: <1192179407-22461-3-git-send-email-andreas@fatal.se>

[-- Attachment #1: Type: text/plain, Size: 785 bytes --]

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>


[-- Attachment #2: x --]
[-- Type: text/plain, Size: 770 bytes --]

diff --git a/ip/iplink.c b/ip/iplink.c
index 4060845..8e0ed2a 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -336,8 +336,10 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
 
 	if (name) {
 		len = strlen(name) + 1;
+		if (len == 1)
+			invarg("\"\" is not a valid device identifier\n", "name");
 		if (len > IFNAMSIZ)
-			invarg("\"name\" too long\n", *argv);
+			invarg("\"name\" too long\n", name);
 		addattr_l(&req.n, sizeof(req), IFLA_IFNAME, name, len);
 	}
 
@@ -670,6 +672,8 @@ static int do_set(int argc, char **argv)
 	}
 
 	if (newname && strcmp(dev, newname)) {
+		if (strlen(newname) == 0)
+			invarg("\"\" is not a valid device identifier\n", "name");
 		if (do_changename(dev, newname) < 0)
 			return -1;
 		dev = newname;

  parent reply	other threads:[~2007-10-12 12:01 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-12  8:56 [PATCH 01/12] Fix various typos and nitpicks Andreas Henriksson
2007-10-12  8:56 ` [PATCH 02/12] Add parameters to usage help text Andreas Henriksson
2007-10-12  8:56   ` [PATCH 03/12] Prevent renaming interfaces to empty string Andreas Henriksson
2007-10-12  8:56     ` [PATCH 04/12] Fix up various problems in netbug script Andreas Henriksson
2007-10-12  8:56       ` [PATCH 05/12] Fix typo in tunnel code (o_key vs. i_key) Andreas Henriksson
2007-10-12  8:56         ` [PATCH 06/12] Remove bogus reference to tc-filters(8) from tc(8) manpage Andreas Henriksson
2007-10-12  8:56           ` [PATCH 07/12] Fix corruption when using batch files with comments and broken lines Andreas Henriksson
2007-10-12  8:56             ` [PATCH 08/12] Fix ematch cmp and nbyte syntax help text Andreas Henriksson
2007-10-12  8:56               ` [PATCH 09/12] Add new rtacct/nstat manpages and additional symlinks Andreas Henriksson
2007-10-12  8:56                 ` [PATCH 10/12] Fix off-by-one in print of wrandom algo Andreas Henriksson
2007-10-12  8:56                   ` [PATCH 11/12] Fix overflow in time2tick / tick2time Andreas Henriksson
2007-10-12  8:56                     ` [PATCH 12/12] Drop bogus reference to tc-filters and add lartc.org link to manpage Andreas Henriksson
2007-10-12 21:50                       ` Stephen Hemminger
2007-10-12 22:49                         ` Patrick McHardy
2007-10-17 16:50                         ` Andreas Henriksson
2007-10-17 17:05                           ` Stephen Hemminger
2007-10-17 17:58                             ` Andreas Henriksson
2007-10-17 18:02                               ` Stephen Hemminger
2007-10-18  8:13                                 ` Andreas Henriksson
2007-10-12 21:39                   ` [PATCH 10/12] Fix off-by-one in print of wrandom algo Stephen Hemminger
2007-10-12 17:14       ` [PATCH 04/12] Fix up various problems in netbug script Stephen Hemminger
2007-10-12 17:39         ` Andreas Henriksson
2007-10-12 12:01     ` Patrick McHardy [this message]
2007-10-12 17:07     ` [PATCH 03/12] Prevent renaming interfaces to empty string Stephen Hemminger
2007-10-12 17:45       ` Andreas Henriksson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=470F6209.6020708@trash.net \
    --to=kaber@trash.net \
    --cc=andreas@fatal.se \
    --cc=formorer@debian.org \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).