diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2010-01-14 01:03:28 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-02-19 10:25:41 -0500 |
commit | 7fee4868be91e71a3ee8e57289ebf5e10a12297e (patch) | |
tree | b2bdbfa885e60fb1c04c2b5fca30ba5fa150fecd /fs/proc | |
parent | ac278a9c505092dd82077a2446af8f9fc0d9c095 (diff) |
Switch proc/self to nd_set_link()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/proc')
-rw-r--r-- | fs/proc/base.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index e42bbd843ed1..58324c299165 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -2369,16 +2369,30 @@ static void *proc_self_follow_link(struct dentry *dentry, struct nameidata *nd) | |||
2369 | { | 2369 | { |
2370 | struct pid_namespace *ns = dentry->d_sb->s_fs_info; | 2370 | struct pid_namespace *ns = dentry->d_sb->s_fs_info; |
2371 | pid_t tgid = task_tgid_nr_ns(current, ns); | 2371 | pid_t tgid = task_tgid_nr_ns(current, ns); |
2372 | char tmp[PROC_NUMBUF]; | 2372 | char *name = ERR_PTR(-ENOENT); |
2373 | if (!tgid) | 2373 | if (tgid) { |
2374 | return ERR_PTR(-ENOENT); | 2374 | name = __getname(); |
2375 | sprintf(tmp, "%d", task_tgid_nr_ns(current, ns)); | 2375 | if (!name) |
2376 | return ERR_PTR(vfs_follow_link(nd,tmp)); | 2376 | name = ERR_PTR(-ENOMEM); |
2377 | else | ||
2378 | sprintf(name, "%d", tgid); | ||
2379 | } | ||
2380 | nd_set_link(nd, name); | ||
2381 | return NULL; | ||
2382 | } | ||
2383 | |||
2384 | static void proc_self_put_link(struct dentry *dentry, struct nameidata *nd, | ||
2385 | void *cookie) | ||
2386 | { | ||
2387 | char *s = nd_get_link(nd); | ||
2388 | if (!IS_ERR(s)) | ||
2389 | __putname(s); | ||
2377 | } | 2390 | } |
2378 | 2391 | ||
2379 | static const struct inode_operations proc_self_inode_operations = { | 2392 | static const struct inode_operations proc_self_inode_operations = { |
2380 | .readlink = proc_self_readlink, | 2393 | .readlink = proc_self_readlink, |
2381 | .follow_link = proc_self_follow_link, | 2394 | .follow_link = proc_self_follow_link, |
2395 | .put_link = proc_self_put_link, | ||
2382 | }; | 2396 | }; |
2383 | 2397 | ||
2384 | /* | 2398 | /* |