diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-07-21 07:33:25 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-07-29 13:24:19 -0400 |
commit | e4fad8e5d220e3dfb1050eee752ee5058f29a232 (patch) | |
tree | b56356fda1d1f4f47e1da63aa24080db999dafc1 /fs/exec.c | |
parent | b5bcdda32736b94a7d178d156d80a69f536ad468 (diff) |
consolidate pipe file creation
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/exec.c')
-rw-r--r-- | fs/exec.c | 19 |
1 files changed, 6 insertions, 13 deletions
@@ -2069,25 +2069,18 @@ static void wait_for_dump_helpers(struct file *file) | |||
2069 | */ | 2069 | */ |
2070 | static int umh_pipe_setup(struct subprocess_info *info, struct cred *new) | 2070 | static int umh_pipe_setup(struct subprocess_info *info, struct cred *new) |
2071 | { | 2071 | { |
2072 | struct file *rp, *wp; | 2072 | struct file *files[2]; |
2073 | struct fdtable *fdt; | 2073 | struct fdtable *fdt; |
2074 | struct coredump_params *cp = (struct coredump_params *)info->data; | 2074 | struct coredump_params *cp = (struct coredump_params *)info->data; |
2075 | struct files_struct *cf = current->files; | 2075 | struct files_struct *cf = current->files; |
2076 | int err = create_pipe_files(files, 0); | ||
2077 | if (err) | ||
2078 | return err; | ||
2076 | 2079 | ||
2077 | wp = create_write_pipe(0); | 2080 | cp->file = files[1]; |
2078 | if (IS_ERR(wp)) | ||
2079 | return PTR_ERR(wp); | ||
2080 | |||
2081 | rp = create_read_pipe(wp, 0); | ||
2082 | if (IS_ERR(rp)) { | ||
2083 | free_write_pipe(wp); | ||
2084 | return PTR_ERR(rp); | ||
2085 | } | ||
2086 | |||
2087 | cp->file = wp; | ||
2088 | 2081 | ||
2089 | sys_close(0); | 2082 | sys_close(0); |
2090 | fd_install(0, rp); | 2083 | fd_install(0, files[0]); |
2091 | spin_lock(&cf->file_lock); | 2084 | spin_lock(&cf->file_lock); |
2092 | fdt = files_fdtable(cf); | 2085 | fdt = files_fdtable(cf); |
2093 | __set_open_fd(0, fdt); | 2086 | __set_open_fd(0, fdt); |