Long-standing bug in syminit, tickled by placing

initshell before syminit.  Don't understand why syminit
exists at all.
This commit is contained in:
rsc 2005-01-15 20:54:41 +00:00
parent 5ad21e8620
commit 3300f9cd89
2 changed files with 5 additions and 3 deletions

View file

@ -39,7 +39,6 @@ main(int argc, char **argv)
* instead of sharing them * instead of sharing them
*/ */
initshell();
Binit(&bout, 1, OWRITE); Binit(&bout, 1, OWRITE);
buf = newbuf(); buf = newbuf();
whatif = 0; whatif = 0;
@ -120,6 +119,7 @@ main(int argc, char **argv)
iflag = 1; iflag = 1;
usage(); usage();
syminit(); syminit();
initshell();
initenv(); initenv();
usage(); usage();

View file

@ -7,11 +7,13 @@ static Symtab *hash[NHASH];
void void
syminit(void) syminit(void)
{ {
Symtab **s, *ss; Symtab **s, *ss, *next;
for(s = hash; s < &hash[NHASH]; s++){ for(s = hash; s < &hash[NHASH]; s++){
for(ss = *s; ss; ss = ss->next) for(ss = *s; ss; ss = next){
next = ss->next;
free((char *)ss); free((char *)ss);
}
*s = 0; *s = 0;
} }
} }