fixed install part of alias_lookup_or_install()
Showing
1 changed file
with
6 additions
and
2 deletions
... | @@ -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 | ... | ... |
-
Please register or sign in to post a comment