summaryrefslogtreecommitdiffstats
path: root/fs/exec.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-08-21 12:11:46 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-09-26 21:09:57 -0400
commit8280d16172243702ed43432f826ca6130edb4086 (patch)
tree020dff359c5b717a110432159bcc3ec1acf6594e /fs/exec.c
parentfe17f22d7fd0e344ef6447238f799bb49f670c6f (diff)
downloadop-kernel-dev-8280d16172243702ed43432f826ca6130edb4086.zip
op-kernel-dev-8280d16172243702ed43432f826ca6130edb4086.tar.gz
new helper: replace_fd()
analog of dup2(), except that it takes struct file * as source. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/exec.c')
-rw-r--r--fs/exec.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/fs/exec.c b/fs/exec.c
index f2b6af5..3fc7468 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -2041,23 +2041,14 @@ static void wait_for_dump_helpers(struct file *file)
static int umh_pipe_setup(struct subprocess_info *info, struct cred *new)
{
struct file *files[2];
- struct fdtable *fdt;
struct coredump_params *cp = (struct coredump_params *)info->data;
- struct files_struct *cf = current->files;
int err = create_pipe_files(files, 0);
if (err)
return err;
cp->file = files[1];
- sys_close(0);
- fd_install(0, files[0]);
- spin_lock(&cf->file_lock);
- fdt = files_fdtable(cf);
- __set_open_fd(0, fdt);
- __clear_close_on_exec(0, fdt);
- spin_unlock(&cf->file_lock);
-
+ replace_fd(0, files[0], 0);
/* and disallow core files too */
current->signal->rlim[RLIMIT_CORE] = (struct rlimit){1, 1};
OpenPOWER on IntegriCloud