Skip to content

Commit

Permalink
cap_prctl: don't set error to 0 at 'no_change'
Browse files Browse the repository at this point in the history
One-liner: capsh --print is broken without this patch.

In certain cases, cap_prctl returns error > 0 for success.  However,
the 'no_change' label was always setting error to 0.  As a result,
for example, 'prctl(CAP_BSET_READ, N)' would always return 0.
It should return 1 if a process has N in its bounding set (as
by default it does).

I'm keeping the no_change label even though it's now functionally
the same as 'error'.

Signed-off-by: Serge Hallyn <serue@us.ibm.com>
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: James Morris <jmorris@namei.org>
  • Loading branch information
Serge E. Hallyn authored and James Morris committed Apr 8, 2009
1 parent 577c9c4 commit 5bf37ec
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion security/commoncap.c
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,6 @@ int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3,
return commit_creds(new);

no_change:
error = 0;
error:
abort_creds(new);
return error;
Expand Down

0 comments on commit 5bf37ec

Please sign in to comment.