Commit 99cc8794 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by Cyrill Gorcunov

reopn_fd_as return code fixlet and cleanup

Nobody cares the returned fd, so just make it 0/-1 and clean up the callers.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent d7ab5f2f
...@@ -523,11 +523,7 @@ static int open_fd(int pid, struct fdinfo_entry *fe, int *cfd) ...@@ -523,11 +523,7 @@ static int open_fd(int pid, struct fdinfo_entry *fe, int *cfd)
if (tmp < 0) if (tmp < 0)
return -1; return -1;
fd = reopen_fd_as((int)fe->addr, tmp); return reopen_fd_as((int)fe->addr, tmp);
if (fd < 0)
return -1;
return 0;
} }
static int open_fmap(int pid, struct fdinfo_entry *fe, int fd) static int open_fmap(int pid, struct fdinfo_entry *fe, int fd)
...@@ -954,12 +950,10 @@ static int reopen_pipe(int src, int *dst, int *other) ...@@ -954,12 +950,10 @@ static int reopen_pipe(int src, int *dst, int *other)
*other = tmp; *other = tmp;
} }
tmp = reopen_fd_as(*dst, src); return reopen_fd_as(*dst, src);
if (tmp < 0) }
return -1;
} else
*dst = src;
*dst = src;
return 0; return 0;
} }
...@@ -1095,8 +1089,7 @@ static int attach_pipe(int pid, struct pipe_entry *e, struct pipe_info *pi, int ...@@ -1095,8 +1089,7 @@ static int attach_pipe(int pid, struct pipe_entry *e, struct pipe_info *pi, int
} }
pr_info("\t%d: Done, reopening for %d\n", pid, e->fd); pr_info("\t%d: Done, reopening for %d\n", pid, e->fd);
tmp = reopen_fd_as(e->fd, fd); if (reopen_fd_as(e->fd, fd))
if (tmp < 0)
return -1; return -1;
pi->users--; pi->users--;
......
...@@ -141,7 +141,7 @@ int reopen_fd_as(int new_fd, int old_fd) ...@@ -141,7 +141,7 @@ int reopen_fd_as(int new_fd, int old_fd)
close_safe(&old_fd); close_safe(&old_fd);
} }
return new_fd; return 0;
} }
int parse_maps(pid_t pid, struct list_head *vma_area_list, bool use_map_files) int parse_maps(pid_t pid, struct list_head *vma_area_list, bool use_map_files)
......
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