[polypaudio-commits] r1016 - /trunk/src/utils/padsp.c
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Tue Jun 13 06:21:15 PDT 2006
Author: ossman
Date: Tue Jun 13 15:21:14 2006
New Revision: 1016
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1016&root=polypaudio&view=rev
Log:
Catch the access() system call as some applications do this to test if they
can open /dev/dsp.
Modified:
trunk/src/utils/padsp.c
Modified: trunk/src/utils/padsp.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/utils/padsp.c?rev=1016&root=polypaudio&r1=1015&r2=1016&view=diff
==============================================================================
--- trunk/src/utils/padsp.c (original)
+++ trunk/src/utils/padsp.c Tue Jun 13 15:21:14 2006
@@ -101,6 +101,7 @@
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. */
@@ -138,6 +139,14 @@
pthread_mutex_lock(&func_mutex); \
if (!_close) \
_close = (int (*)(int)) dlsym_fn(RTLD_NEXT, "close"); \
+ 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)
@@ -1725,6 +1734,25 @@
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;
More information about the pulseaudio-commits
mailing list