aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2012-12-27 01:28:17 -0500
committerMike Frysinger <vapier@gentoo.org>2013-02-24 23:05:05 -0500
commit97ea4d6d14ae90bd6371936fd6a718df0f62efba (patch)
treeea707ff91d0e1c0c38f499c9fa14c4f97dd52f7c /libsbutil/sbutil.h
parentenviron: merge is_env_{on,off} into a single file (diff)
downloadsandbox-97ea4d6d14ae90bd6371936fd6a718df0f62efba.tar.gz
sandbox-97ea4d6d14ae90bd6371936fd6a718df0f62efba.tar.bz2
sandbox-97ea4d6d14ae90bd6371936fd6a718df0f62efba.zip
environ: add a new is_env_var helper for checking var names
This is laying the ground work for processing more vars in the future than just LD_PRELOAD. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'libsbutil/sbutil.h')
-rw-r--r--libsbutil/sbutil.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/libsbutil/sbutil.h b/libsbutil/sbutil.h
index 67a8aaa..6c90f35 100644
--- a/libsbutil/sbutil.h
+++ b/libsbutil/sbutil.h
@@ -19,7 +19,6 @@
#define SANDBOX_CONF_FILE ETCDIR "/sandbox.conf"
#define SANDBOX_CONFD_DIR ETCDIR "/sandbox.d"
-#define LD_PRELOAD_EQ "LD_PRELOAD="
#define LIB_NAME "libsandbox.so"
#define BASHRC_NAME "sandbox.bashrc"
#define TMPDIR "/tmp"
@@ -79,8 +78,12 @@ void get_sandbox_rc(char *path);
void get_sandbox_log(char *path, const char *tmpdir);
void get_sandbox_debug_log(char *path, const char *tmpdir);
int get_tmp_dir(char *path);
-bool is_env_on (const char *);
-bool is_env_off (const char *);
+bool is_env_on(const char *);
+bool is_env_off(const char *);
+static inline bool is_env_var(const char *env, const char *var, size_t vlen)
+{
+ return !strncmp(env, var, vlen) && env[vlen] == '=';
+}
/* proc helpers */
extern const char sb_fd_dir[];