diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2017-11-19 17:17:04 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2017-11-19 17:17:04 +0100 |
commit | e3736b888701c79c9abb3de3fd28fe6ed5d3b168 (patch) | |
tree | ea96b62c726dedc34d173cd164ecd5b106c8c336 /sys/src | |
parent | 89653dcc749a119ef2ee51b5e9812b7820951ec3 (diff) |
kernel: make isaconfig() consistent, not inplace tokenizing the conf string
Diffstat (limited to 'sys/src')
-rw-r--r-- | sys/src/9/mtx/main.c | 13 | ||||
-rw-r--r-- | sys/src/9/omap/main.c | 6 | ||||
-rw-r--r-- | sys/src/9/teg2/main.c | 6 |
3 files changed, 19 insertions, 6 deletions
diff --git a/sys/src/9/mtx/main.c b/sys/src/9/mtx/main.c index 4cc7724d9..6eb0fd7bd 100644 --- a/sys/src/9/mtx/main.c +++ b/sys/src/9/mtx/main.c @@ -360,14 +360,19 @@ getcfields(char* lp, char** fields, int n, char* sep) 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]; diff --git a/sys/src/9/omap/main.c b/sys/src/9/omap/main.c index 598a3ac50..f39105f36 100644 --- a/sys/src/9/omap/main.c +++ b/sys/src/9/omap/main.c @@ -314,7 +314,7 @@ exit(int) 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); @@ -322,6 +322,10 @@ isaconfig(char *class, int ctlrno, ISAConf *isa) 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++){ diff --git a/sys/src/9/teg2/main.c b/sys/src/9/teg2/main.c index 8b1cddb9d..892224132 100644 --- a/sys/src/9/teg2/main.c +++ b/sys/src/9/teg2/main.c @@ -494,7 +494,7 @@ exit(int) 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); @@ -502,6 +502,10 @@ isaconfig(char *class, int ctlrno, ISAConf *isa) 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++){ |