Commit d6f39d70 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

pipe: add ability to restore both ends of inhereted pipes

When we restore an inhereted pipe, we have only one end and we
don't know whether it's write or read one. So we need to call
reopen_pipe each time.
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 98c8e44f
......@@ -314,11 +314,15 @@ static int open_pipe(struct file_desc *d)
int pfd[2];
int sock;
if (inherited_fd(d, &tmp))
return tmp;
pi = container_of(d, struct pipe_info, d);
pr_info("\t\tCreating pipe pipe_id=%#x id=%#x\n", pi->pe->pipe_id, pi->pe->id);
if (inherited_fd(d, &tmp)) {
if (tmp < 0)
return tmp;
pi->reopen = 1;
goto out;
}
if (!pi->create)
return recv_pipe_fd(pi);
......@@ -357,6 +361,7 @@ static int open_pipe(struct file_desc *d)
close(pfd[!(pi->pe->flags & O_WRONLY)]);
tmp = pfd[pi->pe->flags & O_WRONLY];
out:
if (pi->reopen)
tmp = reopen_pipe(tmp, pi->pe->flags);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment