Commit 1d484b71 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

files-reg: Use pb_ helpers to shrink the code

Use recently introduced pb_ helpers to shrink the code.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent ca216745
...@@ -308,7 +308,7 @@ int dump_one_reg_file(int lfd, u32 id, const struct fd_parms *p) ...@@ -308,7 +308,7 @@ int dump_one_reg_file(int lfd, u32 id, const struct fd_parms *p)
int len, rfd; int len, rfd;
RegFileEntry rfe = REG_FILE_ENTRY__INIT; RegFileEntry rfe = REG_FILE_ENTRY__INIT;
FownEntry fown = FOWN_ENTRY__INIT; FownEntry fown;
snprintf(fd_str, sizeof(fd_str), "/proc/self/fd/%d", lfd); snprintf(fd_str, sizeof(fd_str), "/proc/self/fd/%d", lfd);
len = readlink(fd_str, path, sizeof(path) - 1); len = readlink(fd_str, path, sizeof(path) - 1);
...@@ -324,11 +324,7 @@ int dump_one_reg_file(int lfd, u32 id, const struct fd_parms *p) ...@@ -324,11 +324,7 @@ int dump_one_reg_file(int lfd, u32 id, const struct fd_parms *p)
if (check_path_remap(path, &p->stat, lfd, id)) if (check_path_remap(path, &p->stat, lfd, id))
return -1; return -1;
fown.uid = p->fown.uid; pb_prep_fown(&fown, &p->fown);
fown.euid = p->fown.euid;
fown.signum = p->fown.signum;
fown.pid_type = p->fown.pid_type;
fown.pid = p->fown.pid;
rfe.id = id; rfe.id = id;
rfe.flags = p->flags; rfe.flags = p->flags;
...@@ -357,7 +353,6 @@ static int open_path(struct file_desc *d, ...@@ -357,7 +353,6 @@ static int open_path(struct file_desc *d,
int(*open_cb)(struct reg_file_info *, void *), void *arg) int(*open_cb)(struct reg_file_info *, void *), void *arg)
{ {
struct reg_file_info *rfi; struct reg_file_info *rfi;
fown_t fown;
int tmp; int tmp;
rfi = container_of(d, struct reg_file_info, d); rfi = container_of(d, struct reg_file_info, d);
...@@ -378,13 +373,7 @@ static int open_path(struct file_desc *d, ...@@ -378,13 +373,7 @@ static int open_path(struct file_desc *d,
if (rfi->remap_path) if (rfi->remap_path)
unlink(rfi->path); unlink(rfi->path);
fown.uid = rfi->rfe->fown->uid; if (pb_restore_fown(tmp, rfi->rfe->fown))
fown.euid = rfi->rfe->fown->uid;
fown.signum = rfi->rfe->fown->signum;
fown.pid_type = rfi->rfe->fown->pid_type;
fown.pid = rfi->rfe->fown->pid;
if (restore_fown(tmp, &fown))
return -1; return -1;
return tmp; 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