summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2020-02-17 16:20:05 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2020-02-17 16:20:05 +0100
commit22c75924daa41b7ea097796afd4baafa2fc99d05 (patch)
tree8e57f30bb01cf0356344c27b5c78d4c3d72c776c
parent6c4f87e411aa5375eaea5a5909a5c610e38c7e70 (diff)
ash: exec: Never rehash regular built-ins
Upstream commit: Date: Sat, 19 May 2018 02:39:51 +0800 exec: Never rehash regular built-ins As regular (including special) built-ins can never be overridden, we should never remove them from the hash table. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/ash.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/shell/ash.c b/shell/ash.c
index c383cccda..389db3cd0 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -8284,7 +8284,10 @@ clearcmdentry(void)
pp = tblp;
while ((cmdp = *pp) != NULL) {
if (cmdp->cmdtype == CMDNORMAL
- || (cmdp->cmdtype == CMDBUILTIN && builtinloc > 0)
+ || (cmdp->cmdtype == CMDBUILTIN
+ && !IS_BUILTIN_REGULAR(cmdp->param.cmd)
+ && builtinloc > 0
+ )
) {
*pp = cmdp->next;
free(cmdp);
@@ -8403,7 +8406,11 @@ hashcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
cmdp = cmdlookup(name, 0);
if (cmdp != NULL
&& (cmdp->cmdtype == CMDNORMAL
- || (cmdp->cmdtype == CMDBUILTIN && builtinloc >= 0))
+ || (cmdp->cmdtype == CMDBUILTIN
+ && !IS_BUILTIN_REGULAR(cmdp->param.cmd)
+ && builtinloc > 0
+ )
+ )
) {
delete_cmd_entry();
}
@@ -13556,7 +13563,7 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path)
bit = DO_NOFUNC;
break;
case CMDBUILTIN:
- bit = DO_ALTBLTIN;
+ bit = IS_BUILTIN_REGULAR(cmdp->param.cmd) ? 0 : DO_ALTBLTIN;
break;
}
if (act & bit) {