summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/driver/ntux_driver_ctx.c44
1 files changed, 34 insertions, 10 deletions
diff --git a/src/driver/ntux_driver_ctx.c b/src/driver/ntux_driver_ctx.c
index e2440b5..47718ce 100644
--- a/src/driver/ntux_driver_ctx.c
+++ b/src/driver/ntux_driver_ctx.c
@@ -259,6 +259,7 @@ int ntux_get_driver_ctx(
size_t nunits;
const char * program;
char ** parg;
+ char ** pargcap;
char ** cmdargv;
char * cmdmark;
char ** execargv;
@@ -304,18 +305,19 @@ int ntux_get_driver_ctx(
/* initial argv scan: ... --cmd=xxx ... */
argv_scan(argv,optv,&ctx,0);
- /* invalid ntux arguments? */
- if (ctx.erridx && !ctx.unitidx) {
- if (flags & NTUX_DRIVER_VERBOSITY_ERRORS)
- argv_get(
- argv,optv,
- ARGV_VERBOSITY_ERRORS,
- fdctx->fderr);
- return -1;
- }
+ /* position of last base ntux argument */
+ if (ctx.erridx && ctx.unitidx)
+ pargcap = &argv[ctx.unitidx];
+
+ else if (ctx.erridx)
+ pargcap = &argv[ctx.erridx];
+
+ else
+ for (pargcap=argv; *pargcap; pargcap++)
+ (void)0;
/* scan for --cmd */
- for (parg=argv, cmdargv=0; (parg<&argv[ctx.unitidx]) && !cmdargv; parg++) {
+ for (parg=argv, cmdargv=0; (parg<pargcap) && !cmdargv; parg++) {
if (!strcmp(*parg,"--cmd") && parg[1]) {
cmdargv = &parg[2];
cmdmark = parg[2];
@@ -325,6 +327,28 @@ int ntux_get_driver_ctx(
}
}
+ /* invalid ntux arguments? */
+ if (!ctx.erridx) {
+ (void)0;
+
+ } else if (&argv[ctx.erridx] >= cmdargv) {
+ (void)0;
+
+ } else if ((cctx.cmd == NTUX_CMD_SPAWN) && (ctx.erridx > ctx.unitidx)) {
+ (void)0;
+
+ } else if ((cctx.cmd == NTUX_CMD_STRACE) && (ctx.erridx > ctx.unitidx)) {
+ (void)0;
+
+ } else {
+ if (flags & NTUX_DRIVER_VERBOSITY_ERRORS)
+ argv_get(
+ argv,optv,
+ ARGV_VERBOSITY_ERRORS,
+ fdctx->fderr);
+ return -1;
+ }
+
/* process argv entries preceding --cmd */
if (cmdargv) {
*cmdargv = 0;