ref: 69096bf516b451af6b18a8fe82009fd13d427d2a
parent: 26c03933a763847ef9f238e9eee976f93b9ff1da
	author: cinap_lenrek <cinap_lenrek@felloff.net>
	date: Sun Nov 19 12:17:04 EST 2017
	
kernel: make isaconfig() consistent, not inplace tokenizing the conf string
--- a/sys/src/9/mtx/main.c
+++ b/sys/src/9/mtx/main.c
@@ -360,14 +360,19 @@
int
isaconfig(char *class, int ctlrno, ISAConf *isa)
 {+ char cc[32], *p, *x;
int i;
- char cc[KNAMELEN], *p;
- sprint(cc, "%s%d", class, ctlrno);
-
+ snprint(cc, sizeof cc, "%s%d", class, ctlrno);
p = getconf(cc);
- if(p == 0)
+ if(p == nil)
return 0;
+
+ x = nil;
+ kstrdup(&x, p);
+ p = x;
+
+ isa->type = "";
isa->nopt = tokenize(p, isa->opt, NISAOPT);
 	for(i = 0; i < isa->nopt; i++){p = isa->opt[i];
--- a/sys/src/9/omap/main.c
+++ b/sys/src/9/omap/main.c
@@ -314,7 +314,7 @@
int
isaconfig(char *class, int ctlrno, ISAConf *isa)
 {- char cc[32], *p;
+ char cc[32], *p, *x;
int i;
snprint(cc, sizeof cc, "%s%d", class, ctlrno);
@@ -321,6 +321,10 @@
p = getconf(cc);
if(p == nil)
return 0;
+
+ x = nil;
+ kstrdup(&x, p);
+ p = x;
isa->type = "";
isa->nopt = tokenize(p, isa->opt, NISAOPT);
--- a/sys/src/9/teg2/main.c
+++ b/sys/src/9/teg2/main.c
@@ -494,7 +494,7 @@
int
isaconfig(char *class, int ctlrno, ISAConf *isa)
 {- char cc[32], *p;
+ char cc[32], *p, *x;
int i;
snprint(cc, sizeof cc, "%s%d", class, ctlrno);
@@ -501,6 +501,10 @@
p = getconf(cc);
if(p == nil)
return 0;
+
+ x = nil;
+ kstrdup(&x, p);
+ p = x;
isa->type = "";
isa->nopt = tokenize(p, isa->opt, NISAOPT);
--
⑨