summaryrefslogtreecommitdiffstats
path: root/bin/sh/expand.c
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2016-04-09 14:09:14 +0000
committerjilles <jilles@FreeBSD.org>2016-04-09 14:09:14 +0000
commit1a49b5f5b011c2709fb744c8d09ebcec51173672 (patch)
tree84905e679a006c8cbb26b8209bf0a3b46d5fb75a /bin/sh/expand.c
parent15cca94824de0fbecb8dc3951d0a7e27f5a0ec67 (diff)
downloadFreeBSD-src-1a49b5f5b011c2709fb744c8d09ebcec51173672.zip
FreeBSD-src-1a49b5f5b011c2709fb744c8d09ebcec51173672.tar.gz
MFC r278818: sh: Add stsavestr(), like savestr() but allocates using
stalloc().
Diffstat (limited to 'bin/sh/expand.c')
-rw-r--r--bin/sh/expand.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/bin/sh/expand.c b/bin/sh/expand.c
index 1d86698..2113ab7 100644
--- a/bin/sh/expand.c
+++ b/bin/sh/expand.c
@@ -1281,11 +1281,8 @@ addfname(char *name)
{
char *p;
struct strlist *sp;
- size_t len;
- len = strlen(name);
- p = stalloc(len + 1);
- memcpy(p, name, len + 1);
+ p = stsavestr(name);
sp = (struct strlist *)stalloc(sizeof *sp);
sp->text = p;
*exparg.lastp = sp;
OpenPOWER on IntegriCloud