Module Name: src
Committed By: martin
Date: Fri Dec 7 13:14:42 UTC 2018
Modified Files:
src/bin/sh [netbsd-8]: alias.c
Log Message:
Pull up following revision(s) (requested by kre in ticket #1126):
bin/sh/alias.c: revision 1.19
Fix the worst of the bugs in alias processing. This has been in sh
since this code was first imported (May 1994) (ie: before 4.4-Lite)
There is (much) more coming soon (the big ugly comment is going away).
This one has been separated out, as it can easily cause sh
core dumps, so needs:
XXX pullup-8
(the other changes to aliases probably will not get that.)
To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.15.16.1 src/bin/sh/alias.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/bin/sh/alias.c
diff -u src/bin/sh/alias.c:1.15 src/bin/sh/alias.c:1.15.16.1
--- src/bin/sh/alias.c:1.15 Wed Jun 18 18:17:30 2014
+++ src/bin/sh/alias.c Fri Dec 7 13:14:42 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: alias.c,v 1.15 2014/06/18 18:17:30 christos Exp $ */
+/* $NetBSD: alias.c,v 1.15.16.1 2018/12/07 13:14:42 martin Exp $ */
/*-
* Copyright (c) 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)alias.c 8.3 (Berkeley) 5/4/95";
#else
-__RCSID("$NetBSD: alias.c,v 1.15 2014/06/18 18:17:30 christos Exp $");
+__RCSID("$NetBSD: alias.c,v 1.15.16.1 2018/12/07 13:14:42 martin Exp $");
#endif
#endif /* not lint */
@@ -67,17 +67,9 @@ setalias(char *name, char *val)
{
struct alias *ap, **app;
+ (void) unalias(name); /* old one (if any) is now gone */
app = hashalias(name);
- for (ap = *app; ap; ap = ap->next) {
- if (equal(name, ap->name)) {
- INTOFF;
- ckfree(ap->val);
- ap->val = savestr(val);
- INTON;
- return;
- }
- }
- /* not found */
+
INTOFF;
ap = ckmalloc(sizeof (struct alias));
ap->name = savestr(name);