diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-04-11 08:32:05 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-04-11 08:32:05 +0000 |
commit | 917fe3fa612dc457f2e561c6cae0d7c2cbf895dc (patch) | |
tree | 9b39ad1044bb15ea9cc70e507c92fb7579c2bba3 | |
parent | 68619a9de71e9ee26bca3b6a86b22c11e720b91d (diff) | |
download | execline-917fe3fa612dc457f2e561c6cae0d7c2cbf895dc.tar.xz |
bugfix: catch empty blocks in multidefine
-rw-r--r-- | doc/multidefine.html | 2 | ||||
-rw-r--r-- | src/libexecline/exlsn_main.c | 1 | ||||
-rw-r--r-- | src/libexecline/exlsn_multidefine.c | 1 |
3 files changed, 3 insertions, 1 deletions
diff --git a/doc/multidefine.html b/doc/multidefine.html index b51fe6e..e5930a7 100644 --- a/doc/multidefine.html +++ b/doc/multidefine.html @@ -35,7 +35,7 @@ then executes another program. <ul> <li> <tt>multidefine</tt> reads a <a href="el_semicolon.html">block</a> -containing a list of variables. </li> +containing a list of variables. That block must not be empty. </li> <li> <tt>multidefine</tt> <a href="el_transform.html">splits</a> <em>value</em>, and performs other operations depending on the given options. </li> diff --git a/src/libexecline/exlsn_main.c b/src/libexecline/exlsn_main.c index 0fe7bd1..c7747de 100644 --- a/src/libexecline/exlsn_main.c +++ b/src/libexecline/exlsn_main.c @@ -12,6 +12,7 @@ void exlsn_main (int argc, char const **argv, char const *const *envp, exlsnfunc int r = (*func)(argc, argv, envp, &info) ; if (r < 0) switch (r) { + case -4 : strerr_dief1x(100, "empty block") ; case -3 : strerr_dieusage(100, usage) ; case -2 : strerr_dief1x(111, "bad substitution key") ; case -1 : strerr_diefu1sys(111, "complete exlsn function") ; diff --git a/src/libexecline/exlsn_multidefine.c b/src/libexecline/exlsn_multidefine.c index bf50087..c28d926 100644 --- a/src/libexecline/exlsn_multidefine.c +++ b/src/libexecline/exlsn_multidefine.c @@ -41,6 +41,7 @@ int exlsn_multidefine (int argc, char const **argv, char const *const *envp, exl x = argv[0] ; argv++ ; argc-- ; argc1 = el_semicolon(argv) ; + if (!argc1) return -4 ; if (argc1 >= argc) return -3 ; if (!stralloc_cats(&info->values, x)) return -1 ; { |