diff options
author | midipix <writeonce@midipix.org> | 2016-09-12 16:26:28 -0400 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-09-12 17:59:17 -0400 |
commit | 1ed71a9b2fff4dfc73432b94e3049b92d16d1717 (patch) | |
tree | 34920c43d5b63f1b87559151763a5ca07b3acbcc /src | |
parent | 36056550f9a3d0dbca15bc9a200acaca1d68b43a (diff) | |
download | slibtool-1ed71a9b2fff4dfc73432b94e3049b92d16d1717.tar.bz2 slibtool-1ed71a9b2fff4dfc73432b94e3049b92d16d1717.tar.xz |
execute mode: properly handle direct program invocation.
Diffstat (limited to 'src')
-rw-r--r-- | src/logic/slbt_exec_execute.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/logic/slbt_exec_execute.c b/src/logic/slbt_exec_execute.c index 2b422d2..5445cbe 100644 --- a/src/logic/slbt_exec_execute.c +++ b/src/logic/slbt_exec_execute.c @@ -25,6 +25,7 @@ int slbt_exec_execute( char * mark; char exeref [PATH_MAX]; char wrapper[PATH_MAX]; + struct stat st; struct slbt_exec_ctx * actx = 0; /* dry run */ @@ -65,9 +66,13 @@ int slbt_exec_execute( sprintf(mark,".libs/%s",base); /* swap vector */ - ectx->cargv[0] = wrapper; - ectx->cargv[1] = program; - ectx->cargv[2] = exeref; + if (!(stat(script,&st)) && !(stat(wrapper,&st))) { + ectx->cargv[0] = wrapper; + ectx->cargv[1] = program; + ectx->cargv[2] = exeref; + } else { + script = program; + } /* execute mode */ ectx->program = script; @@ -80,7 +85,7 @@ int slbt_exec_execute( return SLBT_NESTED_ERROR(dctx); } - execvp(wrapper,ectx->argv); + execvp(ectx->cargv[0],ectx->argv); slbt_free_exec_ctx(actx); return SLBT_SYSTEM_ERROR(dctx); |