kernel: make isaconfig() consistent, not inplace tokenizing the conf string

This commit is contained in:
cinap_lenrek 2017-11-19 17:17:04 +01:00
parent 89653dcc74
commit e3736b8887
3 changed files with 19 additions and 6 deletions

View file

@ -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];

View file

@ -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++){

View file

@ -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++){