diff options
| author | Jilles Tjoelker <jilles@FreeBSD.org> | 2017-04-16 22:10:02 +0000 |
|---|---|---|
| committer | Jilles Tjoelker <jilles@FreeBSD.org> | 2017-04-16 22:10:02 +0000 |
| commit | 026dfd4aef23cb230f388e1e11faecd7a508f4e6 (patch) | |
| tree | dae36b569ceb34ae3711b0eb4b7719b720bce969 /bin/sh | |
| parent | 683bf56cf6c582fccdec8f233ccbadc8532c1ba4 (diff) | |
Notes
Diffstat (limited to 'bin/sh')
| -rw-r--r-- | bin/sh/alias.c | 11 | ||||
| -rw-r--r-- | bin/sh/tests/parser/Makefile | 1 | ||||
| -rw-r--r-- | bin/sh/tests/parser/alias18.0 | 8 |
3 files changed, 10 insertions, 10 deletions
diff --git a/bin/sh/alias.c b/bin/sh/alias.c index e67ad649ff70..bbcf5fbe17e3 100644 --- a/bin/sh/alias.c +++ b/bin/sh/alias.c @@ -63,17 +63,8 @@ setalias(const char *name, const char *val) { struct alias *ap, **app; + unalias(name); 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); diff --git a/bin/sh/tests/parser/Makefile b/bin/sh/tests/parser/Makefile index dd749e34b520..28816a926807 100644 --- a/bin/sh/tests/parser/Makefile +++ b/bin/sh/tests/parser/Makefile @@ -24,6 +24,7 @@ ${PACKAGE}FILES+= alias14.0 ${PACKAGE}FILES+= alias15.0 alias15.0.stdout ${PACKAGE}FILES+= alias16.0 ${PACKAGE}FILES+= alias17.0 +${PACKAGE}FILES+= alias18.0 ${PACKAGE}FILES+= and-pipe-not.0 ${PACKAGE}FILES+= case1.0 ${PACKAGE}FILES+= case2.0 diff --git a/bin/sh/tests/parser/alias18.0 b/bin/sh/tests/parser/alias18.0 new file mode 100644 index 000000000000..74234fe72c05 --- /dev/null +++ b/bin/sh/tests/parser/alias18.0 @@ -0,0 +1,8 @@ +# $FreeBSD$ + +v=1 +alias a='alias a=v=2 +v=3 +a' +eval a +[ "$v" = 2 ] |
