Eliminate a little bit of duplicated code.

This commit is contained in:
Alan Cox 2010-07-23 18:58:27 +00:00
parent dc1ccafedd
commit 69a8f9e3d1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=210429
4 changed files with 5 additions and 9 deletions

View File

@ -200,9 +200,7 @@ linux_exec_copyin_args(struct image_args *args, char *fname,
return (0);
err_exit:
kmem_free_wakeup(exec_map, (vm_offset_t)args->buf,
PATH_MAX + ARG_MAX + MAXSHELLCMDLEN);
args->buf = NULL;
exec_free_args(args);
return (error);
}

View File

@ -355,9 +355,7 @@ freebsd32_exec_copyin_args(struct image_args *args, char *fname,
return (0);
err_exit:
kmem_free_wakeup(exec_map, (vm_offset_t)args->buf,
PATH_MAX + ARG_MAX + MAXSHELLCMDLEN);
args->buf = NULL;
exec_free_args(args);
return (error);
}

View File

@ -105,7 +105,6 @@ static int sysctl_kern_usrstack(SYSCTL_HANDLER_ARGS);
static int sysctl_kern_stackprot(SYSCTL_HANDLER_ARGS);
static int do_execve(struct thread *td, struct image_args *args,
struct mac *mac_p);
static void exec_free_args(struct image_args *);
/* XXX This should be vm_size_t. */
SYSCTL_PROC(_kern, KERN_PS_STRINGS, ps_strings, CTLTYPE_ULONG|CTLFLAG_RD,
@ -1155,11 +1154,11 @@ exec_copyin_args(struct image_args *args, char *fname,
return (error);
}
static void
void
exec_free_args(struct image_args *args)
{
if (args->buf) {
if (args->buf != NULL) {
kmem_free_wakeup(exec_map, (vm_offset_t)args->buf,
PATH_MAX + ARG_MAX + MAXSHELLCMDLEN);
args->buf = NULL;

View File

@ -80,6 +80,7 @@ struct thread;
int exec_check_permissions(struct image_params *);
register_t *exec_copyout_strings(struct image_params *);
void exec_free_args(struct image_args *);
int exec_new_vmspace(struct image_params *, struct sysentvec *);
void exec_setregs(struct thread *, struct image_params *, u_long);
int exec_shell_imgact(struct image_params *);