]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] sys_capget should use current if the pid argument is 0
authorChris Wright <chris@wirex.com>
Tue, 19 Nov 2002 09:02:05 +0000 (01:02 -0800)
committerLinus Torvalds <torvalds@home.transmeta.com>
Tue, 19 Nov 2002 09:02:05 +0000 (01:02 -0800)
kernel/capability.c

index 774cf612d8c5d0ec276dedb070306e9f1f99aef0..5e2c835aba6519aacac57e84897593e835fed772 100644 (file)
@@ -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);