Skip to content

Commit

Permalink
[NET] dev_change_name: ignore changes to same name
Browse files Browse the repository at this point in the history
Prevent error/backtrace from dev_rename() when changing
name of network device to the same name. This is a common
situation with udev and other scripts that bind addr to device.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Stephen Hemminger authored and David S. Miller committed Oct 26, 2007
1 parent 8c56a34 commit c8d90dc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,9 @@ int dev_change_name(struct net_device *dev, char *newname)
if (!dev_valid_name(newname))
return -EINVAL;

if (strncmp(newname, dev->name, IFNAMSIZ) == 0)
return 0;

memcpy(oldname, dev->name, IFNAMSIZ);

if (strchr(newname, '%')) {
Expand Down

0 comments on commit c8d90dc

Please sign in to comment.