summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_exec.c')
-rw-r--r--sys/kern/kern_exec.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 784ed5c..0e5c94c 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -469,9 +469,9 @@ interpret:
PROC_UNLOCK(p);
setugidsafety(td);
error = fdcheckstd(td);
- PROC_LOCK(p);
if (error != 0)
goto done1;
+ PROC_LOCK(p);
/*
* Set the new credentials.
*/
@@ -543,24 +543,23 @@ interpret:
oldargs = p->p_args;
p->p_args = NULL;
- /* Set values passed into the program in registers. */
- if (p->p_sysent->sv_setregs)
- (*p->p_sysent->sv_setregs)(td, imgp->entry_addr,
- (u_long)(uintptr_t)stack_base, imgp->ps_strings);
- else
- exec_setregs(td, imgp->entry_addr,
- (u_long)(uintptr_t)stack_base, imgp->ps_strings);
-
/* Cache arguments if they fit inside our allowance */
if (ps_arg_cache_limit >= i + sizeof(struct pargs)) {
bcopy(imgp->stringbase, newargs->ar_args, i);
p->p_args = newargs;
newargs = NULL;
}
-done1:
PROC_UNLOCK(p);
+ /* Set values passed into the program in registers. */
+ if (p->p_sysent->sv_setregs)
+ (*p->p_sysent->sv_setregs)(td, imgp->entry_addr,
+ (u_long)(uintptr_t)stack_base, imgp->ps_strings);
+ else
+ exec_setregs(td, imgp->entry_addr,
+ (u_long)(uintptr_t)stack_base, imgp->ps_strings);
+done1:
/*
* Free any resources malloc'd earlier that we didn't use.
*/
OpenPOWER on IntegriCloud