From: Antti Kantee Date: Tue, 20 Oct 2015 14:56:07 +0000 (+0000) Subject: Perform some config sanity checks X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=2b2ffa4693763baa9ec11d5f6df91fac3c56d882;p=osstest%2Frumprun.git Perform some config sanity checks --- diff --git a/lib/librumprun_base/config.c b/lib/librumprun_base/config.c index cfd1dc6..7216cac 100644 --- a/lib/librumprun_base/config.c +++ b/lib/librumprun_base/config.c @@ -750,6 +750,7 @@ void rumprun_config(char *cmdline) { char *cfg; + struct rumprun_exec *rre; jsmn_parser p; jsmntok_t *tokens = NULL; jsmntok_t *t; @@ -810,5 +811,16 @@ rumprun_config(char *cmdline) T_PRINTFSTAR(t, cmdline)); } + /* + * Before we start running things, perform some sanity checks + */ + rre = TAILQ_LAST(&rumprun_execs, rumprun_execs); + if (rre == NULL) { + errx(1, "rumprun_config: no bins"); + } + if (rre->rre_flags & RUMPRUN_EXEC_PIPE) { + errx(1, "rumprun_config: last bin may not output to pipe"); + } + free(tokens); }