diff options
author | Jilles Tjoelker <jilles@FreeBSD.org> | 2015-08-19 20:31:03 +0000 |
---|---|---|
committer | Jilles Tjoelker <jilles@FreeBSD.org> | 2015-08-19 20:31:03 +0000 |
commit | 89cead337af64e70a6ac854f01d2699afd83751c (patch) | |
tree | b4e077d645909eff7dcb96ed78b213229629211b /tools/regression/lib/libc | |
parent | b38fbc2e549ff9f20e496e3f643b9b08ad463601 (diff) | |
download | src-89cead337af64e70a6ac854f01d2699afd83751c.tar.gz src-89cead337af64e70a6ac854f01d2699afd83751c.zip |
wordexp(): Improve some error codes.
Distinguish between WRDE_BADVAL and WRDE_SYNTAX based on when the error
occurred (parsing or execution), not based on whether WRDE_UNDEF was passed.
Also, return WRDE_NOSPACE for a few more unexpected results from sh.
Notes
Notes:
svn path=/head/; revision=286941
Diffstat (limited to 'tools/regression/lib/libc')
-rw-r--r-- | tools/regression/lib/libc/gen/test-wordexp.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/regression/lib/libc/gen/test-wordexp.c b/tools/regression/lib/libc/gen/test-wordexp.c index 069190f54c70..68b1578e4d04 100644 --- a/tools/regression/lib/libc/gen/test-wordexp.c +++ b/tools/regression/lib/libc/gen/test-wordexp.c @@ -206,6 +206,15 @@ main(int argc, char *argv[]) assert(strcmp(we.we_wordv[0], "\\") == 0); assert(we.we_wordv[1] == NULL); wordfree(&we); + /* Two syntax errors that are not detected by the current we_check(). */ + r = wordexp("${IFS:+'}", &we, 0); + assert(r == WRDE_SYNTAX); + r = wordexp("${IFS:+'}", &we, WRDE_UNDEF); + assert(r == WRDE_SYNTAX); + r = wordexp("$(case)", &we, 0); + assert(r == WRDE_SYNTAX); + r = wordexp("$(case)", &we, WRDE_UNDEF); + assert(r == WRDE_SYNTAX); /* With a SIGCHLD handler that reaps all zombies. */ sa.sa_flags = 0; |