aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Schlemmer <azarah@gentoo.org>2006-07-05 17:06:40 +0000
committerMartin Schlemmer <azarah@gentoo.org>2006-07-05 17:06:40 +0000
commit9ad2db7aecb08012339c34dbaf72991686547f58 (patch)
tree83f14051c9b1d889e2306c195b6484ebf2095372 /src
parentUse librcutil. (diff)
downloadsandbox-9ad2db7aecb08012339c34dbaf72991686547f58.tar.gz
sandbox-9ad2db7aecb08012339c34dbaf72991686547f58.tar.bz2
sandbox-9ad2db7aecb08012339c34dbaf72991686547f58.zip
Fix build failure due to exists() still being needed for libsandbox.
Signed-off-by: Martin Schlemmer <azarah@gentoo.org>
Diffstat (limited to 'src')
-rw-r--r--src/sandbox.h1
-rw-r--r--src/sandbox_utils.c22
2 files changed, 23 insertions, 0 deletions
diff --git a/src/sandbox.h b/src/sandbox.h
index f21efe5..3a3c2a4 100644
--- a/src/sandbox.h
+++ b/src/sandbox.h
@@ -106,6 +106,7 @@ bool is_env_on (const char *);
bool is_env_off (const char *);
#ifndef OUTSIDE_LIBSANDBOX
+int exists(const char *pathname);
/* Compat functions for GNU extensions */
char *gstrndup (const char *str, size_t size);
/* Same as basename(3), but do not modify path */
diff --git a/src/sandbox_utils.c b/src/sandbox_utils.c
index 070c2de..7591e3f 100644
--- a/src/sandbox_utils.c
+++ b/src/sandbox_utils.c
@@ -29,7 +29,11 @@ void get_sandbox_lib(char *path)
snprintf(path, SB_PATH_MAX, "%s", LIB_NAME);
#else
snprintf(path, SB_PATH_MAX, "%s/%s", LIBSANDBOX_PATH, LIB_NAME);
+# ifdef OUTSIDE_LIBSANDBOX
+ if (0 >= rc_file_exists(path)) {
+# else
if (0 >= exists(path)) {
+# endif
snprintf(path, SB_PATH_MAX, "%s", LIB_NAME);
}
#endif
@@ -132,6 +136,24 @@ bool is_env_off (const char *env)
#ifndef OUTSIDE_LIBSANDBOX
+int exists(const char *pathname)
+{
+ struct stat buf;
+ int retval;
+
+ if ((NULL == pathname) || (0 == strlen(pathname)))
+ return 0;
+
+ retval = lstat(pathname, &buf);
+ if (-1 != retval)
+ return 1;
+ /* Some or other error occurred */
+ if (ENOENT != errno)
+ return -1;
+
+ return 0;
+}
+
char * gstrndup (const char *str, size_t size)
{
char *new_str = NULL;