cap_prctl: don't set error to 0 at 'no_change'
authorSerge E. Hallyn <serue@us.ibm.com>
Wed, 8 Apr 2009 21:55:58 +0000 (16:55 -0500)
committerJames Morris <jmorris@namei.org>
Wed, 8 Apr 2009 23:12:03 +0000 (09:12 +1000)
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>
security/commoncap.c

index 7cd61a5f520557f1991e6e2d093c3c4133ed4307..beac0258c2a8f3a0cbad52ec9adf12e019264626 100644 (file)
@@ -916,7 +916,6 @@ changed:
        return commit_creds(new);
 
 no_change:
-       error = 0;
 error:
        abort_creds(new);
        return error;