From 2ece3386512695d90cddaf183e9f0208652f893b Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sun, 21 Feb 2016 20:58:24 +0000 Subject: [PATCH] sh: Don't hash alias name when there are no aliases. --- bin/sh/alias.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/sh/alias.c b/bin/sh/alias.c index a77ce99a9f07..a35513b0011b 100644 --- a/bin/sh/alias.c +++ b/bin/sh/alias.c @@ -144,9 +144,11 @@ rmaliases(void) struct alias * lookupalias(const char *name, int check) { - struct alias *ap = *hashalias(name); + struct alias *ap; - for (; ap; ap = ap->next) { + if (aliases == 0) + return (NULL); + for (ap = *hashalias(name); ap; ap = ap->next) { if (equal(name, ap->name)) { if (check && (ap->flag & ALIASINUSE)) return (NULL);