summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2015-08-19 20:31:03 +0000
committerjilles <jilles@FreeBSD.org>2015-08-19 20:31:03 +0000
commit23ea14394056d1cc1eeff8b67732953fc6c60bee (patch)
treeb4e077d645909eff7dcb96ed78b213229629211b /tools
parent1c9ebc8c01d333f11486321587e573c45b810bf5 (diff)
downloadFreeBSD-src-23ea14394056d1cc1eeff8b67732953fc6c60bee.zip
FreeBSD-src-23ea14394056d1cc1eeff8b67732953fc6c60bee.tar.gz
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.
Diffstat (limited to 'tools')
-rw-r--r--tools/regression/lib/libc/gen/test-wordexp.c9
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 069190f..68b1578 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;
OpenPOWER on IntegriCloud