aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-02-15 01:08:00 -0500
committerMike Frysinger <vapier@gentoo.org>2009-02-15 01:08:00 -0500
commitc2eee93088aad4876c2f25fcb78d67ad18ffa425 (patch)
tree992578dace40f636257459f16bfcc09194896daa /libsandbox
parentlibsandbox: make sure all mknod symbols are wrapped (diff)
downloadsandbox-c2eee93088aad4876c2f25fcb78d67ad18ffa425.tar.gz
sandbox-c2eee93088aad4876c2f25fcb78d67ad18ffa425.tar.bz2
sandbox-c2eee93088aad4876c2f25fcb78d67ad18ffa425.zip
libsandbox: calculate longest symbol name dynamically
The longest wrapped symbol name has hit the hard limit of 10 chars, so rather than manually bump it up, calculate it on the fly with the awk scripts. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'libsandbox')
-rw-r--r--libsandbox/Makefile.am2
-rw-r--r--libsandbox/libsandbox.c19
2 files changed, 9 insertions, 12 deletions
diff --git a/libsandbox/Makefile.am b/libsandbox/Makefile.am
index e38cc29..97d8864 100644
--- a/libsandbox/Makefile.am
+++ b/libsandbox/Makefile.am
@@ -53,7 +53,7 @@ symbols.h: $(SYMBOLS_FILE) $(SYMBOLS_WRAPPERS) $(GEN_HEADER_SCRIPT)
SB_NR_FILE = $(srcdir)/sb_nr.h.in
sb_nr.h: symbols.h $(SB_NR_FILE)
- $(EGREP) -h '^\#define SB_NR_' $^ > $@
+ $(EGREP) -h '^\#define SB_' $^ > $@
EXTRA_DIST = $(SYMBOLS_FILE) $(SYMBOLS_WRAPPERS) $(SB_NR_FILE)
diff --git a/libsandbox/libsandbox.c b/libsandbox/libsandbox.c
index ffda996..758b9e5 100644
--- a/libsandbox/libsandbox.c
+++ b/libsandbox/libsandbox.c
@@ -744,17 +744,14 @@ static int check_syscall(sbcontext_t *sbcontext, int sb_nr, const char *func, co
result = check_access(sbcontext, sb_nr, func, absolute_path, resolved_path);
- if (1 == verbose) {
- if ((0 == result) && (1 == sbcontext->show_access_violation)) {
- SB_EERROR("ACCESS DENIED", " %s:%*s%s\n",
- func, (int)(10 - strlen(func)), "", absolute_path);
- } else if ((1 == debug) && (1 == sbcontext->show_access_violation)) {
- SB_EINFO("ACCESS ALLOWED", " %s:%*s%s\n",
- func, (int)(10 - strlen(func)), "", absolute_path);
- } else if ((1 == debug) && (0 == sbcontext->show_access_violation)) {
- SB_EWARN("ACCESS PREDICTED", " %s:%*s%s\n",
- func, (int)(10 - strlen(func)), "", absolute_path);
- }
+ if (verbose) {
+ int sym_len = SB_MAX_STRING_LEN + 1 - strlen(func);
+ if (!result && sbcontext->show_access_violation)
+ SB_EERROR("ACCESS DENIED", " %s:%*s%s\n", func, sym_len, "", absolute_path);
+ else if (debug && sbcontext->show_access_violation)
+ SB_EINFO("ACCESS ALLOWED", " %s:%*s%s\n", func, sym_len, "", absolute_path);
+ else if (debug && !sbcontext->show_access_violation)
+ SB_EWARN("ACCESS PREDICTED", " %s:%*s%s\n", func, sym_len, "", absolute_path);
}
if ((0 == result) && (1 == sbcontext->show_access_violation))