From 707d7cf19dd6fa1d1256b257df893e79e9ba9222 Mon Sep 17 00:00:00 2001 From: Michael Santos Date: Fri, 3 Feb 2017 09:47:12 -0500 Subject: [PATCH] Display enforced sandbox in verbose mode --- Makefile | 3 ++- src/xmppipe.c | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 867fbf2..fbcde68 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,8 @@ endif XMPPIPE_SANDBOX ?= XMPPIPE_SANDBOX_NULL XMPPIPE_SANDBOX_RLIMIT_NOFILE ?= -1 -CFLAGS += -D$(XMPPIPE_SANDBOX) -DXMPPIPE_SANDBOX_RLIMIT_NOFILE=$(XMPPIPE_SANDBOX_RLIMIT_NOFILE) +CFLAGS += -DXMPPIPE_SANDBOX=\"$(XMPPIPE_SANDBOX)\" -D$(XMPPIPE_SANDBOX) \ + -DXMPPIPE_SANDBOX_RLIMIT_NOFILE=$(XMPPIPE_SANDBOX_RLIMIT_NOFILE) all: $(CC) -g -Wall $(CFLAGS) -o xmppipe src/*.c $(LDFLAGS) -lstrophe diff --git a/src/xmppipe.c b/src/xmppipe.c index 1c7ae9b..9010497 100644 --- a/src/xmppipe.c +++ b/src/xmppipe.c @@ -221,9 +221,11 @@ main(int argc, char **argv) if (xmppipe_connect_init(state) < 0) errx(EXIT_FAILURE, "XMPP handshake failed"); - if (xmppipe_sandbox_init(state) < 0) { + if (state->verbose) + (void)fprintf(stderr, "sandbox: entering %s\n", XMPPIPE_SANDBOX); + + if (xmppipe_sandbox_init(state) < 0) err(EXIT_FAILURE, "sandbox failed"); - } if (xmppipe_stream_init(state) < 0) errx(EXIT_FAILURE, "enabling stream management failed");