aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2012-12-25 00:58:56 -0500
committerMike Frysinger <vapier@gentoo.org>2013-02-24 23:05:05 -0500
commitc8118ad3af11dce5f67d595b3784c5010c764579 (patch)
treec37f4faf08f574b376e6b3d3cb39cec812427edd /libsandbox
parentlibsandbox: reject "" paths with *at funcs before checking the dirfd [missing... (diff)
downloadsandbox-c8118ad3af11dce5f67d595b3784c5010c764579.tar.gz
sandbox-c8118ad3af11dce5f67d595b3784c5010c764579.tar.bz2
sandbox-c8118ad3af11dce5f67d595b3784c5010c764579.zip
libsandbox: add some likely/unlikely settings
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'libsandbox')
-rw-r--r--libsandbox/libsandbox.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/libsandbox/libsandbox.c b/libsandbox/libsandbox.c
index 184fc0b..bdef2d9 100644
--- a/libsandbox/libsandbox.c
+++ b/libsandbox/libsandbox.c
@@ -821,7 +821,7 @@ static int check_syscall(sbcontext_t *sbcontext, int sb_nr, const char *func,
result = check_access(sbcontext, sb_nr, func, flags, absolute_path, resolved_path);
- if (verbose) {
+ if (unlikely(verbose)) {
int sym_len = SB_MAX_STRING_LEN + 1 - strlen(func);
if (!result && sbcontext->show_access_violation)
sb_eerror("%sACCESS DENIED%s: %s:%*s%s\n",
@@ -839,22 +839,20 @@ static int check_syscall(sbcontext_t *sbcontext, int sb_nr, const char *func,
else
access = true;
- if (!access) {
+ if (unlikely(!access)) {
bool worked = write_logfile(log_path, func, file, absolute_path, resolved_path, access);
if (!worked && errno)
goto error;
}
- if (debug) {
+ if (unlikely(debug)) {
bool worked = write_logfile(debug_log_path, func, file, absolute_path, resolved_path, access);
if (!worked && errno)
goto error;
}
- if (NULL != absolute_path)
- free(absolute_path);
- if (NULL != resolved_path)
- free(resolved_path);
+ free(absolute_path);
+ free(resolved_path);
errno = old_errno;