Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/sh Fix the worst of the bugs in alias processing. This...



details:   https://anonhg.NetBSD.org/src/rev/3124b87d9c33
branches:  trunk
changeset: 446360:3124b87d9c33
user:      kre <kre%NetBSD.org@localhost>
date:      Sun Dec 02 10:27:58 2018 +0000

description:
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.)

diffstat:

 bin/sh/alias.c |  16 ++++------------
 1 files changed, 4 insertions(+), 12 deletions(-)

diffs (38 lines):

diff -r 9796b43e853d -r 3124b87d9c33 bin/sh/alias.c
--- a/bin/sh/alias.c    Sun Dec 02 10:06:45 2018 +0000
+++ b/bin/sh/alias.c    Sun Dec 02 10:27:58 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: alias.c,v 1.18 2018/12/01 01:20:05 kre Exp $   */
+/*     $NetBSD: alias.c,v 1.19 2018/12/02 10:27:58 kre 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.18 2018/12/01 01:20:05 kre Exp $");
+__RCSID("$NetBSD: alias.c,v 1.19 2018/12/02 10:27:58 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -69,17 +69,9 @@
 {
        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);



Home | Main Index | Thread Index | Old Index