diff options
| author | Rasmus Villemoes <linux@rasmusvillemoes.dk> | 2015-10-21 17:44:27 -0400 |
|---|---|---|
| committer | Paul Moore <pmoore@redhat.com> | 2015-10-21 17:44:27 -0400 |
| commit | 9529c7886c0741847eeb85cf2b0e0730eebe4fa5 (patch) | |
| tree | 67c47ad3799aaa914ce5c374b750fca019df5bb1 /security | |
| parent | 21b76f199e25d32b0a7ed3833ca9204898262c24 (diff) | |
selinux: use sprintf return value
sprintf returns the number of characters printed (excluding '\0'), so
we can use that and avoid duplicating the length computation.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Paul Moore <pmoore@redhat.com>
Diffstat (limited to 'security')
| -rw-r--r-- | security/selinux/ss/services.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index aa2bdcb20848..ebb5eb3c318c 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c | |||
| @@ -1218,13 +1218,10 @@ static int context_struct_to_string(struct context *context, char **scontext, u3 | |||
| 1218 | /* | 1218 | /* |
| 1219 | * Copy the user name, role name and type name into the context. | 1219 | * Copy the user name, role name and type name into the context. |
| 1220 | */ | 1220 | */ |
| 1221 | sprintf(scontextp, "%s:%s:%s", | 1221 | scontextp += sprintf(scontextp, "%s:%s:%s", |
| 1222 | sym_name(&policydb, SYM_USERS, context->user - 1), | 1222 | sym_name(&policydb, SYM_USERS, context->user - 1), |
| 1223 | sym_name(&policydb, SYM_ROLES, context->role - 1), | 1223 | sym_name(&policydb, SYM_ROLES, context->role - 1), |
| 1224 | sym_name(&policydb, SYM_TYPES, context->type - 1)); | 1224 | sym_name(&policydb, SYM_TYPES, context->type - 1)); |
| 1225 | scontextp += strlen(sym_name(&policydb, SYM_USERS, context->user - 1)) + | ||
| 1226 | 1 + strlen(sym_name(&policydb, SYM_ROLES, context->role - 1)) + | ||
| 1227 | 1 + strlen(sym_name(&policydb, SYM_TYPES, context->type - 1)); | ||
| 1228 | 1225 | ||
| 1229 | mls_sid_to_context(context, &scontextp); | 1226 | mls_sid_to_context(context, &scontextp); |
| 1230 | 1227 | ||
