| 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(-)
--- |
| @@ -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){ |
| @@ -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; |