diff options
| author | Jilles Tjoelker <jilles@FreeBSD.org> | 2015-08-16 19:42:15 +0000 |
|---|---|---|
| committer | Jilles Tjoelker <jilles@FreeBSD.org> | 2015-08-16 19:42:15 +0000 |
| commit | 842ad8ac0b5cb0989b9580d6af84bb97571aa701 (patch) | |
| tree | 545ed5805d6d80f67c3f2909fcd8307346948898 /lib | |
| parent | 38be29d321c1e041a1f27f53c123c9e8c6151df9 (diff) | |
Notes
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/libc/gen/wordexp.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libc/gen/wordexp.c b/lib/libc/gen/wordexp.c index c7f4b1d0e9024..d0ddcf0ba78eb 100644 --- a/lib/libc/gen/wordexp.c +++ b/lib/libc/gen/wordexp.c @@ -138,8 +138,7 @@ we_askshell(const char *words, wordexp_t *we, int flags) } else if (pid == 0) { /* - * We are the child; just get /bin/sh to run the wordexp - * builtin on `words'. + * We are the child; make /bin/sh expand `words'. */ (void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL); if ((pdes[1] != STDOUT_FILENO ? @@ -147,7 +146,9 @@ we_askshell(const char *words, wordexp_t *we, int flags) _fcntl(pdes[1], F_SETFD, 0)) < 0) _exit(1); execl(_PATH_BSHELL, "sh", flags & WRDE_UNDEF ? "-u" : "+u", - "-c", "IFS=$1;eval \"$2\";eval \"wordexp $3\"", "", + "-c", "IFS=$1;eval \"$2\";eval \"set -- $3\";IFS=;a=\"$*\";" + "printf '%08x' \"$#\" \"${#a}\";printf '%s\\0' \"$@\"", + "", ifs != NULL ? ifs : " \t\n", flags & WRDE_SHOWERR ? "" : "exec 2>/dev/null", words, (char *)NULL); |
