From 5b28e3905a24f17fbbaedbe692f19c4bd9b57b5e Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 26 Apr 2009 12:06:09 -0400 Subject: 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 --- libsbutil/Makefile.am | 1 + libsbutil/get_sandbox_confd.c | 23 +++++++++++++++++++++++ libsbutil/sbutil.h | 1 + 3 files changed, 25 insertions(+) create mode 100644 libsbutil/get_sandbox_confd.c (limited to 'libsbutil') 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); -- cgit v1.2.3-65-gdbad