kernel: make isaconfig() consistent, not inplace tokenizing the conf string
This commit is contained in:
parent
89653dcc74
commit
e3736b8887
3 changed files with 19 additions and 6 deletions
|
@ -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];
|
||||
|
|
|
@ -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++){
|
||||
|
|
|
@ -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++){
|
||||
|
|
Loading…
Reference in a new issue