Switch proc/self to nd_set_link()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@@ -2369,16 +2369,30 @@ static void *proc_self_follow_link(struct dentry *dentry, struct nameidata *nd)
|
|||||||
{
|
{
|
||||||
struct pid_namespace *ns = dentry->d_sb->s_fs_info;
|
struct pid_namespace *ns = dentry->d_sb->s_fs_info;
|
||||||
pid_t tgid = task_tgid_nr_ns(current, ns);
|
pid_t tgid = task_tgid_nr_ns(current, ns);
|
||||||
char tmp[PROC_NUMBUF];
|
char *name = ERR_PTR(-ENOENT);
|
||||||
if (!tgid)
|
if (tgid) {
|
||||||
return ERR_PTR(-ENOENT);
|
name = __getname();
|
||||||
sprintf(tmp, "%d", task_tgid_nr_ns(current, ns));
|
if (!name)
|
||||||
return ERR_PTR(vfs_follow_link(nd,tmp));
|
name = ERR_PTR(-ENOMEM);
|
||||||
|
else
|
||||||
|
sprintf(name, "%d", tgid);
|
||||||
|
}
|
||||||
|
nd_set_link(nd, name);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void proc_self_put_link(struct dentry *dentry, struct nameidata *nd,
|
||||||
|
void *cookie)
|
||||||
|
{
|
||||||
|
char *s = nd_get_link(nd);
|
||||||
|
if (!IS_ERR(s))
|
||||||
|
__putname(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct inode_operations proc_self_inode_operations = {
|
static const struct inode_operations proc_self_inode_operations = {
|
||||||
.readlink = proc_self_readlink,
|
.readlink = proc_self_readlink,
|
||||||
.follow_link = proc_self_follow_link,
|
.follow_link = proc_self_follow_link,
|
||||||
|
.put_link = proc_self_put_link,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user