merge r2106 from trunk

git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2160 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Lennart Poettering 2008-03-27 23:30:23 +00:00
parent b79c6b6bc0
commit e704fd358c

View file

@ -1443,18 +1443,18 @@ fail:
static int real_open(const char *filename, int flags, mode_t mode) { static int real_open(const char *filename, int flags, mode_t mode) {
int r, _errno = 0; int r, _errno = 0;
debug(DEBUG_LEVEL_VERBOSE, __FILE__": open(%s)\n", filename); debug(DEBUG_LEVEL_VERBOSE, __FILE__": open(%s)\n", filename?filename:"NULL");
if (!function_enter()) { if (!function_enter()) {
LOAD_OPEN_FUNC(); LOAD_OPEN_FUNC();
return _open(filename, flags, mode); return _open(filename, flags, mode);
} }
if (dsp_cloak_enable() && (strcmp(filename, "/dev/dsp") == 0 || strcmp(filename, "/dev/adsp") == 0)) if (filename && dsp_cloak_enable() && (strcmp(filename, "/dev/dsp") == 0 || strcmp(filename, "/dev/adsp") == 0))
r = dsp_open(flags, &_errno); r = dsp_open(flags, &_errno);
else if (mixer_cloak_enable() && strcmp(filename, "/dev/mixer") == 0) else if (filename && mixer_cloak_enable() && strcmp(filename, "/dev/mixer") == 0)
r = mixer_open(flags, &_errno); r = mixer_open(flags, &_errno);
else if (sndstat_cloak_enable() && strcmp(filename, "/dev/sndstat") == 0) else if (filename && sndstat_cloak_enable() && strcmp(filename, "/dev/sndstat") == 0)
r = sndstat_open(flags, &_errno); r = sndstat_open(flags, &_errno);
else { else {
function_exit(); function_exit();
@ -2371,18 +2371,13 @@ int close(int fd) {
int access(const char *pathname, int mode) { int access(const char *pathname, int mode) {
if (!pathname) { debug(DEBUG_LEVEL_VERBOSE, __FILE__": access(%s)\n", pathname?pathname:"NULL");
/* Firefox needs this. See #27 */
errno = EFAULT;
return -1;
}
debug(DEBUG_LEVEL_VERBOSE, __FILE__": access(%s)\n", pathname); if (!pathname ||
( strcmp(pathname, "/dev/dsp") != 0 &&
if (strcmp(pathname, "/dev/dsp") != 0 &&
strcmp(pathname, "/dev/adsp") != 0 && strcmp(pathname, "/dev/adsp") != 0 &&
strcmp(pathname, "/dev/sndstat") != 0 && strcmp(pathname, "/dev/sndstat") != 0 &&
strcmp(pathname, "/dev/mixer") != 0) { strcmp(pathname, "/dev/mixer") != 0 )) {
LOAD_ACCESS_FUNC(); LOAD_ACCESS_FUNC();
return _access(pathname, mode); return _access(pathname, mode);
} }
@ -2406,16 +2401,13 @@ int stat(const char *pathname, struct stat *buf) {
#endif #endif
int ret; int ret;
if (!pathname || !buf) { if (!pathname ||
errno = EFAULT; !buf ||
return -1; ( strcmp(pathname, "/dev/dsp") != 0 &&
}
if (strcmp(pathname, "/dev/dsp") != 0 &&
strcmp(pathname, "/dev/adsp") != 0 && strcmp(pathname, "/dev/adsp") != 0 &&
strcmp(pathname, "/dev/sndstat") != 0 && strcmp(pathname, "/dev/sndstat") != 0 &&
strcmp(pathname, "/dev/mixer") != 0) { strcmp(pathname, "/dev/mixer") != 0 )) {
debug(DEBUG_LEVEL_VERBOSE, __FILE__": stat(%s)\n", pathname); debug(DEBUG_LEVEL_VERBOSE, __FILE__": stat(%s)\n", pathname?pathname:"NULL");
LOAD_STAT_FUNC(); LOAD_STAT_FUNC();
return _stat(pathname, buf); return _stat(pathname, buf);
} }
@ -2464,17 +2456,14 @@ int stat64(const char *pathname, struct stat64 *buf) {
struct stat oldbuf; struct stat oldbuf;
int ret; int ret;
if (!pathname || !buf) { debug(DEBUG_LEVEL_VERBOSE, __FILE__": stat64(%s)\n", pathname?pathname:"NULL");
errno = EFAULT;
return -1;
}
debug(DEBUG_LEVEL_VERBOSE, __FILE__": stat64(%s)\n", pathname); if (!pathname ||
!buf ||
if (strcmp(pathname, "/dev/dsp") != 0 && ( strcmp(pathname, "/dev/dsp") != 0 &&
strcmp(pathname, "/dev/adsp") != 0 && strcmp(pathname, "/dev/adsp") != 0 &&
strcmp(pathname, "/dev/sndstat") != 0 && strcmp(pathname, "/dev/sndstat") != 0 &&
strcmp(pathname, "/dev/mixer") != 0) { strcmp(pathname, "/dev/mixer") != 0 )) {
LOAD_STAT64_FUNC(); LOAD_STAT64_FUNC();
return _stat64(pathname, buf); return _stat64(pathname, buf);
} }
@ -2504,7 +2493,7 @@ int open64(const char *filename, int flags, ...) {
va_list args; va_list args;
mode_t mode = 0; mode_t mode = 0;
debug(DEBUG_LEVEL_VERBOSE, __FILE__": open64(%s)\n", filename); debug(DEBUG_LEVEL_VERBOSE, __FILE__": open64(%s)\n", filename?filename:"NULL");
if (flags & O_CREAT) { if (flags & O_CREAT) {
va_start(args, flags); va_start(args, flags);
@ -2515,10 +2504,11 @@ int open64(const char *filename, int flags, ...) {
va_end(args); va_end(args);
} }
if (strcmp(filename, "/dev/dsp") != 0 && if (!filename ||
( strcmp(filename, "/dev/dsp") != 0 &&
strcmp(filename, "/dev/adsp") != 0 && strcmp(filename, "/dev/adsp") != 0 &&
strcmp(filename, "/dev/sndstat") != 0 && strcmp(filename, "/dev/sndstat") != 0 &&
strcmp(filename, "/dev/mixer") != 0) { strcmp(filename, "/dev/mixer") != 0 )) {
LOAD_OPEN64_FUNC(); LOAD_OPEN64_FUNC();
return _open64(filename, flags, mode); return _open64(filename, flags, mode);
} }
@ -2531,17 +2521,14 @@ int open64(const char *filename, int flags, ...) {
#ifdef _STAT_VER #ifdef _STAT_VER
int __xstat(int ver, const char *pathname, struct stat *buf) { int __xstat(int ver, const char *pathname, struct stat *buf) {
if (!pathname || !buf) { debug(DEBUG_LEVEL_VERBOSE, __FILE__": __xstat(%s)\n", pathname?pathname:"NULL");
errno = EFAULT;
return -1;
}
debug(DEBUG_LEVEL_VERBOSE, __FILE__": __xstat(%s)\n", pathname); if (!pathname ||
!buf ||
if (strcmp(pathname, "/dev/dsp") != 0 && ( strcmp(pathname, "/dev/dsp") != 0 &&
strcmp(pathname, "/dev/adsp") != 0 && strcmp(pathname, "/dev/adsp") != 0 &&
strcmp(pathname, "/dev/sndstat") != 0 && strcmp(pathname, "/dev/sndstat") != 0 &&
strcmp(pathname, "/dev/mixer") != 0) { strcmp(pathname, "/dev/mixer") != 0 )) {
LOAD_XSTAT_FUNC(); LOAD_XSTAT_FUNC();
return ___xstat(ver, pathname, buf); return ___xstat(ver, pathname, buf);
} }
@ -2557,17 +2544,14 @@ int __xstat(int ver, const char *pathname, struct stat *buf) {
#ifdef HAVE_OPEN64 #ifdef HAVE_OPEN64
int __xstat64(int ver, const char *pathname, struct stat64 *buf) { int __xstat64(int ver, const char *pathname, struct stat64 *buf) {
if (!pathname || !buf) { debug(DEBUG_LEVEL_VERBOSE, __FILE__": __xstat64(%s)\n", pathname?pathname:"NULL");
errno = EFAULT;
return -1;
}
debug(DEBUG_LEVEL_VERBOSE, __FILE__": __xstat64(%s)\n", pathname); if (!pathname ||
!buf ||
if (strcmp(pathname, "/dev/dsp") != 0 && ( strcmp(pathname, "/dev/dsp") != 0 &&
strcmp(pathname, "/dev/adsp") != 0 && strcmp(pathname, "/dev/adsp") != 0 &&
strcmp(pathname, "/dev/sndstat") != 0 && strcmp(pathname, "/dev/sndstat") != 0 &&
strcmp(pathname, "/dev/mixer") != 0) { strcmp(pathname, "/dev/mixer") != 0 )) {
LOAD_XSTAT64_FUNC(); LOAD_XSTAT64_FUNC();
return ___xstat64(ver, pathname, buf); return ___xstat64(ver, pathname, buf);
} }
@ -2589,12 +2573,14 @@ FILE* fopen(const char *filename, const char *mode) {
int fd; int fd;
mode_t m; mode_t m;
debug(DEBUG_LEVEL_VERBOSE, __FILE__": fopen(%s)\n", filename); debug(DEBUG_LEVEL_VERBOSE, __FILE__": fopen(%s)\n", filename?filename:"NULL");
if (strcmp(filename, "/dev/dsp") != 0 && if (!filename ||
!mode ||
( strcmp(filename, "/dev/dsp") != 0 &&
strcmp(filename, "/dev/adsp") != 0 && strcmp(filename, "/dev/adsp") != 0 &&
strcmp(filename, "/dev/sndstat") != 0 && strcmp(filename, "/dev/sndstat") != 0 &&
strcmp(filename, "/dev/mixer") != 0) { strcmp(filename, "/dev/mixer") != 0 )) {
LOAD_FOPEN_FUNC(); LOAD_FOPEN_FUNC();
return _fopen(filename, mode); return _fopen(filename, mode);
} }
@ -2630,12 +2616,14 @@ FILE* fopen(const char *filename, const char *mode) {
FILE *fopen64(const char *filename, const char *mode) { FILE *fopen64(const char *filename, const char *mode) {
debug(DEBUG_LEVEL_VERBOSE, __FILE__": fopen64(%s)\n", filename); debug(DEBUG_LEVEL_VERBOSE, __FILE__": fopen64(%s)\n", filename?filename:"NULL");
if (strcmp(filename, "/dev/dsp") != 0 && if (!filename ||
!mode ||
( strcmp(filename, "/dev/dsp") != 0 &&
strcmp(filename, "/dev/adsp") != 0 && strcmp(filename, "/dev/adsp") != 0 &&
strcmp(filename, "/dev/sndstat") != 0 && strcmp(filename, "/dev/sndstat") != 0 &&
strcmp(filename, "/dev/mixer") != 0) { strcmp(filename, "/dev/mixer") != 0 )) {
LOAD_FOPEN64_FUNC(); LOAD_FOPEN64_FUNC();
return _fopen64(filename, mode); return _fopen64(filename, mode);
} }