Messages in this thread Patch in this message | | | Date | Mon, 20 Mar 2000 22:26:49 +0000 (GMT) | From | Tim Waugh <> | Subject | [patch] 2.3.99-pre3-3: dev_alloc_name |
| |
Part of the ether= problem is that the "eth%d" strings are all merged, and get overwritten by dev_alloc_name. Here's the trivial fix for that.
Tim. */
--- linux/net/core/dev.c.orig Mon Mar 20 22:20:58 2000 +++ linux/net/core/dev.c Mon Mar 20 22:25:14 2000 @@ -343,6 +343,20 @@ } /* + * Yes, this really is implemented privately for the nth + * time in the kernel. + */ + +static char *strdup (const char *str) +{ + int n = strlen (str) + 1; + char *s = kmalloc (n, GFP_KERNEL); + if (s) + strcpy (s, str); + return s; +} + +/* * Passed a format string - eg "lt%d" it will try and find a suitable * id. Not efficient for many devices, not called a lot.. */ @@ -358,7 +372,7 @@ for (i = 0; i < 100; i++) { sprintf(buf,name,i); if (__dev_get_by_name(buf) == NULL) { - strcpy(dev->name, buf); + dev->name = strdup (buf); return i; } }
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |