summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/utils/padsp.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/utils/padsp.c b/src/utils/padsp.c
index 8bad126b..da8f6786 100644
--- a/src/utils/padsp.c
+++ b/src/utils/padsp.c
@@ -101,6 +101,7 @@ static FILE* (*_fopen)(const char *path, const char *mode) = NULL;
static int (*_open64)(const char *, int, mode_t) = NULL;
static FILE* (*_fopen64)(const char *path, const char *mode) = NULL;
static int (*_fclose)(FILE *f) = NULL;
+static int (*_access)(const char *, int) = NULL;
/* dlsym() violates ISO C, so confide the breakage into this function to
* avoid warnings. */
@@ -141,6 +142,14 @@ do { \
pthread_mutex_unlock(&func_mutex); \
} while(0)
+#define LOAD_ACCESS_FUNC() \
+do { \
+ pthread_mutex_lock(&func_mutex); \
+ if (!_access) \
+ _access = (int (*)(const char*, int)) dlsym_fn(RTLD_NEXT, "access"); \
+ pthread_mutex_unlock(&func_mutex); \
+} while(0)
+
#define LOAD_FOPEN_FUNC() \
do { \
pthread_mutex_lock(&func_mutex); \
@@ -1725,6 +1734,25 @@ int close(int fd) {
return 0;
}
+int access(const char *pathname, int mode) {
+ debug(__FILE__": access()\n");
+
+ if (strcmp(pathname, "/dev/dsp") != 0 &&
+ strcmp(pathname, "/dev/adsp") != 0 &&
+ strcmp(pathname, "/dev/sndstat") != 0 &&
+ strcmp(pathname, "/dev/mixer") != 0) {
+ LOAD_ACCESS_FUNC();
+ return _access(pathname, mode);
+ }
+
+ if (mode & (W_OK | X_OK)) {
+ errno = EACCES;
+ return -1;
+ }
+
+ return 0;
+}
+
int open64(const char *filename, int flags, ...) {
va_list args;
mode_t mode = 0;