Commit 695f2c70 695f2c707ba10fd67f2170c55112874ca5ad48c0 by Sergey Poznyakoff

fixed install part of alias_lookup_or_install()

1 parent f4a0c376
...@@ -120,6 +120,7 @@ alias_t * ...@@ -120,6 +120,7 @@ alias_t *
120 alias_lookup_or_install(char *name, int install) 120 alias_lookup_or_install(char *name, int install)
121 { 121 {
122 unsigned i, pos; 122 unsigned i, pos;
123 alias_t *slot = NULL;
123 124
124 if (!aliases) 125 if (!aliases)
125 { 126 {
...@@ -138,8 +139,8 @@ alias_lookup_or_install(char *name, int install) ...@@ -138,8 +139,8 @@ alias_lookup_or_install(char *name, int install)
138 { 139 {
139 if (aliases[i].name == NULL) 140 if (aliases[i].name == NULL)
140 { 141 {
141 if (install) 142 if (!slot && install)
142 return &aliases[i]; 143 slot = &aliases[i];
143 } 144 }
144 else if (strcmp(aliases[i].name, name) == 0) 145 else if (strcmp(aliases[i].name, name) == 0)
145 return &aliases[i]; 146 return &aliases[i];
...@@ -152,6 +153,9 @@ alias_lookup_or_install(char *name, int install) ...@@ -152,6 +153,9 @@ alias_lookup_or_install(char *name, int install)
152 if (!install) 153 if (!install)
153 return NULL; 154 return NULL;
154 155
156 if (slot)
157 return slot;
158
155 if (alias_rehash()) 159 if (alias_rehash())
156 return NULL; 160 return NULL;
157 161
......