diff options
-rw-r--r-- | bin/sh/alias.c | 2 | ||||
-rw-r--r-- | bin/sh/exec.c | 5 |
2 files changed, 3 insertions, 4 deletions
diff --git a/bin/sh/alias.c b/bin/sh/alias.c index 21f3f44..a77ce99 100644 --- a/bin/sh/alias.c +++ b/bin/sh/alias.c @@ -248,7 +248,7 @@ hashalias(const char *p) { unsigned int hashval; - hashval = *p << 4; + hashval = (unsigned char)*p << 4; while (*p) hashval+= *p++; return &atab[hashval % ATABSIZE]; diff --git a/bin/sh/exec.c b/bin/sh/exec.c index e547e31..d245b55 100644 --- a/bin/sh/exec.c +++ b/bin/sh/exec.c @@ -524,17 +524,16 @@ static struct tblentry **lastcmdentry; static struct tblentry * cmdlookup(const char *name, int add) { - int hashval; + unsigned int hashval; const char *p; struct tblentry *cmdp; struct tblentry **pp; size_t len; p = name; - hashval = *p << 4; + hashval = (unsigned char)*p << 4; while (*p) hashval += *p++; - hashval &= 0x7FFF; pp = &cmdtable[hashval % CMDTABLESIZE]; for (cmdp = *pp ; cmdp ; cmdp = cmdp->next) { if (equal(cmdp->cmdname, name)) |