Commit 3736fcf9 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

pipes: fix error handling

Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 967ca651
......@@ -247,14 +247,15 @@ err:
return ret;
}
static int reopen_pipe(int fd, int flags, struct pipe_info *pi)
static int reopen_pipe(int fd, int flags)
{
int ret;
char path[32];
pr_err("%s %p %d\n", __func__, pi, fd);
snprintf(path, sizeof(path), "/proc/self/fd/%d", fd);
ret = open(path, flags);
if (ret < 0)
pr_perror("Unable to reopen the pipe %s", path);
close(fd);
return ret;
......@@ -278,7 +279,7 @@ static int recv_pipe_fd(struct pipe_info *pi)
close(fd);
if (pi->reopen)
fd = reopen_pipe(tmp, pi->pe->flags, pi);
fd = reopen_pipe(tmp, pi->pe->flags);
else
fd = tmp;
if (fd >= 0) {
......@@ -340,10 +341,11 @@ static int open_pipe(struct file_desc *d)
tmp = pfd[pi->pe->flags & O_WRONLY];
if (pi->reopen)
tmp = reopen_pipe(tmp, pi->pe->flags, pi);
tmp = reopen_pipe(tmp, pi->pe->flags);
if (rst_file_params(tmp, pi->pe->fown, pi->pe->flags))
return -1;
if (tmp >= 0)
if (rst_file_params(tmp, pi->pe->fown, pi->pe->flags))
return -1;
return tmp;
}
......
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