summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-04-26 12:06:09 -0400
committerMike Frysinger <vapier@gentoo.org>2009-04-26 12:06:09 -0400
commit5b28e3905a24f17fbbaedbe692f19c4bd9b57b5e (patch)
treef1fdb2284c9e4555628be17d0071677c1d9c6253 /libsbutil
parenttests: use AUTOTEST_PATH rather than setting PATH manually (diff)
downloadsandbox-5b28e3905a24f17fbbaedbe692f19c4bd9b57b5e.tar.gz
sandbox-5b28e3905a24f17fbbaedbe692f19c4bd9b57b5e.tar.bz2
sandbox-5b28e3905a24f17fbbaedbe692f19c4bd9b57b5e.zip
setup local sandbox.d for running tests to avoid /etc/sandbox.d
Always use local sandbox.d copy to avoid random /etc/sandbox.d issues like it doesn't exist, or has permission problems, or anything else. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'libsbutil')
-rw-r--r--libsbutil/Makefile.am1
-rw-r--r--libsbutil/get_sandbox_confd.c23
-rw-r--r--libsbutil/sbutil.h1
3 files changed, 25 insertions, 0 deletions
diff --git a/libsbutil/Makefile.am b/libsbutil/Makefile.am
index 4a82d62..8975201 100644
--- a/libsbutil/Makefile.am
+++ b/libsbutil/Makefile.am
@@ -15,6 +15,7 @@ libsbutil_la_LDFLAGS = -no-undefined
libsbutil_la_SOURCES = \
sbutil.h \
get_sandbox_conf.c \
+ get_sandbox_confd.c \
get_sandbox_lib.c \
get_sandbox_rc.c \
get_sandbox_log.c \
diff --git a/libsbutil/get_sandbox_confd.c b/libsbutil/get_sandbox_confd.c
new file mode 100644
index 0000000..ffe3021
--- /dev/null
+++ b/libsbutil/get_sandbox_confd.c
@@ -0,0 +1,23 @@
+/*
+ * get_sandbox_confd.c
+ *
+ * Util functions.
+ *
+ * Copyright 1999-2009 Gentoo Foundation
+ * Licensed under the GPL-2
+ */
+
+#include "headers.h"
+#include "sbutil.h"
+
+char *get_sandbox_confd(char *path)
+{
+ save_errno();
+ if (is_env_on(ENV_SANDBOX_TESTING))
+ snprintf(path, SB_PATH_MAX, "%s/etc/sandbox.d/",
+ getenv("abs_top_srcdir"));
+ else
+ strcpy(path, SANDBOX_CONFD_DIR);
+ restore_errno();
+ return path;
+}
diff --git a/libsbutil/sbutil.h b/libsbutil/sbutil.h
index d76e0c9..523cf01 100644
--- a/libsbutil/sbutil.h
+++ b/libsbutil/sbutil.h
@@ -81,6 +81,7 @@ extern const char env_sandbox_testing[];
#define SB_EERROR(_hilight, _args...) sb_efunc(COLOR_RED, _hilight, _args)
char *get_sandbox_conf(void);
+char *get_sandbox_confd(char *path);
void get_sandbox_lib(char *path);
void get_sandbox_rc(char *path);
void get_sandbox_log(char *path);