addether: copy dev string - vx32 - Local 9vx git repository for patches.
git clone git://r-36.net/vx32
Log
Files
Refs
---
commit 3d471e6ac421b0148d299273f65ca96bb7312e9f
parent 63886a0f0e4e2e423f7b544275543cf6bbef5a55
Author: Jesus Galan Lopez (yiyus) 
Date:   Tue, 28 Sep 2010 21:39:28 +0200

addether: copy dev string

Diffstat:
  M src/9vx/conf.c                      |      12 +++++++-----
  M src/9vx/main.c                      |       2 +-

2 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/src/9vx/conf.c b/src/9vx/conf.c
@@ -17,7 +17,7 @@ char        filebuf[BOOTARGSLEN];
 static void
 addether(char *name, char *value)
 {
-        char *p;
+        char *p, *q;
         int ctlrno;
 
         ctlrno = atoi(&name[5]);
@@ -40,10 +40,12 @@ addether(char *name, char *value)
                 }
                 else if(strncmp(p, "dev=", 4) == 0){
                         p += 4;
-                        ve[ctlrno].dev = p;
-                        while(*p && *p != ' ' && *p != '\t')
-                                p++;
-                        *p++ = '\0';
+                        q = p;
+                        while(*q && *q != ' ' && *q != '\t')
+                                q++;
+                        ve[ctlrno].dev = malloc(q - p + 1);
+                        strncpy(ve[ctlrno].dev, p, q - p);
+                        ve[ctlrno].dev[q-p] = '\0';
                         continue;
                 }
                 else if(strncmp(p, "ea=", 3) == 0){
diff --git a/src/9vx/main.c b/src/9vx/main.c
@@ -304,7 +304,7 @@ bootinit(void)
          * bootcode.9 is the file bootpcf.out obtained running
          * mk in the ./boot/ directory from inside 9vx.
          *
-         * TODO(yy): The boot methods should be optional
+         * TODO(yy): boot methods should be optional
          */
         extern uchar iso9660code[];
         extern long iso9660len;