summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorChris Wright <chris@wirex.com>2002-11-19 01:02:05 -0800
committerLinus Torvalds <torvalds@home.transmeta.com>2002-11-19 01:02:05 -0800
commit36a0426742ce32c36345cefaf2d0cddabad8e4d3 (patch)
tree91a1d12590462c6555c26bd19ca0a5e0108867a3 /kernel
parent78d78c9d5932e5634995418f8eebb5aaac1f432c (diff)
[PATCH] sys_capget should use current if the pid argument is 0
Diffstat (limited to 'kernel')
-rw-r--r--kernel/capability.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/kernel/capability.c b/kernel/capability.c
index 774cf612d8c5..5e2c835aba65 100644
--- a/kernel/capability.c
+++ b/kernel/capability.c
@@ -54,11 +54,14 @@ asmlinkage long sys_capget(cap_user_header_t header, cap_user_data_t dataptr)
spin_lock(&task_capability_lock);
read_lock(&tasklist_lock);
- target = find_task_by_pid(pid);
- if (!target) {
- ret = -ESRCH;
- goto out;
- }
+ if (pid && pid != current->pid) {
+ target = find_task_by_pid(pid);
+ if (!target) {
+ ret = -ESRCH;
+ goto out;
+ }
+ } else
+ target = current;
data.permitted = cap_t(target->cap_permitted);
data.inheritable = cap_t(target->cap_inheritable);