lkml.org 
[lkml]   [2000]   [Mar]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    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/

    \
     
     \ /
      Last update: 2005-03-22 13:57    [W:4.931 / U:0.448 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site