From 8435d3c02c8802b5019ee98f13f0270b332106c5 Mon Sep 17 00:00:00 2001 From: jilles Date: Mon, 1 Apr 2013 20:50:07 +0000 Subject: 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. --- lib/libc/gen/wordexp.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'lib/libc') 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) -- cgit v1.1