diff options
author | 2006-07-05 17:06:40 +0000 | |
---|---|---|
committer | 2006-07-05 17:06:40 +0000 | |
commit | 9ad2db7aecb08012339c34dbaf72991686547f58 (patch) | |
tree | 83f14051c9b1d889e2306c195b6484ebf2095372 | |
parent | Use librcutil. (diff) | |
download | sandbox-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>
-rw-r--r-- | src/sandbox.h | 1 | ||||
-rw-r--r-- | src/sandbox_utils.c | 22 |
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; |