only lksh now implies unalias for a POSIX function definition (used e.g. in Debian sysvinit scripts that use a “stop” function)

This commit is contained in:
tg
2015-03-20 23:37:55 +00:00
parent 8641829e21
commit 07898d8a45
4 changed files with 117 additions and 16 deletions

4
exec.c
View File

@@ -23,7 +23,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.146 2015/02/19 22:26:49 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.147 2015/03/20 23:37:54 tg Exp $");
#ifndef MKSH_DEFAULT_EXECSHELL
#define MKSH_DEFAULT_EXECSHELL "/bin/sh"
@@ -1020,11 +1020,13 @@ define(const char *name, struct op *t)
nhash = hash(name);
#ifdef MKSH_LEGACY_MODE
if (t != NULL && !tobool(t->u.ksh_func)) {
/* drop same-name aliases for POSIX functions */
if ((tp = ktsearch(&aliases, name, nhash)))
ktdelete(tp);
}
#endif
while (/* CONSTCOND */ 1) {
tp = findfunc(name, nhash, true);