]> xenbits.xensource.com Git - osstest/rumprun.git/commitdiff
Perform some config sanity checks
authorAntti Kantee <pooka@iki.fi>
Tue, 20 Oct 2015 14:56:07 +0000 (14:56 +0000)
committerAntti Kantee <pooka@iki.fi>
Tue, 20 Oct 2015 14:56:41 +0000 (14:56 +0000)
lib/librumprun_base/config.c

index cfd1dc6d28783c53ac330d020ee08a7e2bcfa291..7216cacc3cee96e6da7945dd4afb847f264e619e 100644 (file)
@@ -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);
 }