diff options
author | David Howells <dhowells@redhat.com> | 2008-11-13 18:39:18 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2008-11-13 18:39:18 -0500 |
commit | 86a264abe542cfececb4df129bc45a0338d8cdb9 (patch) | |
tree | 30152f04ba847f311028d5ca697f864c16c7ebb3 /fs/exec.c | |
parent | f1752eec6145c97163dbce62d17cf5d928e28a27 (diff) |
CRED: Wrap current->cred and a few other accessors
Wrap current->cred and a few other accessors to hide their actual
implementation.
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: James Morris <jmorris@namei.org>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'fs/exec.c')
-rw-r--r-- | fs/exec.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1388,6 +1388,7 @@ EXPORT_SYMBOL(set_binfmt); | |||
1388 | */ | 1388 | */ |
1389 | static int format_corename(char *corename, long signr) | 1389 | static int format_corename(char *corename, long signr) |
1390 | { | 1390 | { |
1391 | const struct cred *cred = current_cred(); | ||
1391 | const char *pat_ptr = core_pattern; | 1392 | const char *pat_ptr = core_pattern; |
1392 | int ispipe = (*pat_ptr == '|'); | 1393 | int ispipe = (*pat_ptr == '|'); |
1393 | char *out_ptr = corename; | 1394 | char *out_ptr = corename; |
@@ -1424,7 +1425,7 @@ static int format_corename(char *corename, long signr) | |||
1424 | /* uid */ | 1425 | /* uid */ |
1425 | case 'u': | 1426 | case 'u': |
1426 | rc = snprintf(out_ptr, out_end - out_ptr, | 1427 | rc = snprintf(out_ptr, out_end - out_ptr, |
1427 | "%d", current_uid()); | 1428 | "%d", cred->uid); |
1428 | if (rc > out_end - out_ptr) | 1429 | if (rc > out_end - out_ptr) |
1429 | goto out; | 1430 | goto out; |
1430 | out_ptr += rc; | 1431 | out_ptr += rc; |
@@ -1432,7 +1433,7 @@ static int format_corename(char *corename, long signr) | |||
1432 | /* gid */ | 1433 | /* gid */ |
1433 | case 'g': | 1434 | case 'g': |
1434 | rc = snprintf(out_ptr, out_end - out_ptr, | 1435 | rc = snprintf(out_ptr, out_end - out_ptr, |
1435 | "%d", current_gid()); | 1436 | "%d", cred->gid); |
1436 | if (rc > out_end - out_ptr) | 1437 | if (rc > out_end - out_ptr) |
1437 | goto out; | 1438 | goto out; |
1438 | out_ptr += rc; | 1439 | out_ptr += rc; |