summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/wordexp.c
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2013-04-01 20:50:07 +0000
committerjilles <jilles@FreeBSD.org>2013-04-01 20:50:07 +0000
commit8435d3c02c8802b5019ee98f13f0270b332106c5 (patch)
tree5cabe0e6eee561c3332e1206fccea783f53729b8 /lib/libc/gen/wordexp.c
parent5d624f8f14afb145964ba64fad16cecd1bc094a0 (diff)
downloadFreeBSD-src-8435d3c02c8802b5019ee98f13f0270b332106c5.zip
FreeBSD-src-8435d3c02c8802b5019ee98f13f0270b332106c5.tar.gz
wordexp(): Remove wrong IFS usage.
Words in shell script are separated by spaces or tabs independent of the value of IFS. The value of IFS is only relevant for the result of substitutions. Therefore, there should be a space between 'wordexp' and the words to be expanded, not an IFS character. Paranoia might dictate that the shell ignore IFS from the environment (even though our sh currently uses it), so do not depend on it in the new test case.
Diffstat (limited to 'lib/libc/gen/wordexp.c')
-rw-r--r--lib/libc/gen/wordexp.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/libc/gen/wordexp.c b/lib/libc/gen/wordexp.c
index bcab1f5..b518b57 100644
--- a/lib/libc/gen/wordexp.c
+++ b/lib/libc/gen/wordexp.c
@@ -114,15 +114,12 @@ we_askshell(const char *words, wordexp_t *we, int flags)
int status; /* Child exit status */
int error; /* Our return value */
int serrno; /* errno to return */
- char *ifs; /* IFS env. var. */
char *np, *p; /* Handy pointers */
char *nstrings; /* Temporary for realloc() */
char **nwv; /* Temporary for realloc() */
sigset_t newsigblock, oldsigblock;
serrno = errno;
- if ((ifs = getenv("IFS")) == NULL)
- ifs = " \t\n";
if (pipe(pdes) < 0)
return (WRDE_NOSPACE); /* XXX */
@@ -150,7 +147,7 @@ we_askshell(const char *words, wordexp_t *we, int flags)
if (_dup2(pdes[1], STDOUT_FILENO) < 0)
_exit(1);
_close(pdes[1]);
- if (asprintf(&cmd, "wordexp%c%s\n", *ifs, words) < 0)
+ if (asprintf(&cmd, "wordexp %s\n", words) < 0)
_exit(1);
if ((flags & WRDE_SHOWERR) == 0) {
if ((devnull = _open(_PATH_DEVNULL, O_RDWR, 0666)) < 0)
OpenPOWER on IntegriCloud