]> code.delx.au - pulseaudio/blobdiff - src/utils/padsp.c
Merge remote branch 'origin/master-tx'
[pulseaudio] / src / utils / padsp.c
index 2e6e557586bb2de60a1e230d1428f9e67ca19d6e..41bfd741e618e8ff20e55d26ae946cc92d32abb6 100644 (file)
@@ -6,7 +6,7 @@
 
   PulseAudio is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as published
-  by the Free Software Foundation; either version 2 of the License,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -53,6 +53,7 @@
 #include <pulse/pulseaudio.h>
 #include <pulse/gccmacro.h>
 #include <pulsecore/llist.h>
+#include <pulsecore/core-util.h>
 
 /* On some systems SIOCINQ isn't defined, but FIONREAD is just an alias */
 #if !defined(SIOCINQ) && defined(FIONREAD)
@@ -459,15 +460,16 @@ static void reset_params(fd_info *i) {
 }
 
 static const char *client_name(char *buf, size_t n) {
-    char p[PATH_MAX];
+    char *p;
     const char *e;
 
     if ((e = getenv("PADSP_CLIENT_NAME")))
         return e;
 
-    if (pa_get_binary_name(p, sizeof(p)))
+    if ((p = pa_get_binary_name_malloc())) {
         snprintf(buf, n, "OSS Emulation[%s]", p);
-    else
+        pa_xfree(p);
+    } else
         snprintf(buf, n, "OSS");
 
     return buf;
@@ -1202,7 +1204,7 @@ fail:
 static void sink_info_cb(pa_context *context, const pa_sink_info *si, int eol, void *userdata) {
     fd_info *i = userdata;
 
-    if (!si && eol < 0) {
+    if (!si || eol < 0) {
         i->operation_success = 0;
         pa_threaded_mainloop_signal(i->mainloop, 0);
         return;
@@ -1224,7 +1226,7 @@ static void sink_info_cb(pa_context *context, const pa_sink_info *si, int eol, v
 static void source_info_cb(pa_context *context, const pa_source_info *si, int eol, void *userdata) {
     fd_info *i = userdata;
 
-    if (!si && eol < 0) {
+    if (!si || eol < 0) {
         i->operation_success = 0;
         pa_threaded_mainloop_signal(i->mainloop, 0);
         return;
@@ -1819,7 +1821,7 @@ fail:
 
     pa_threaded_mainloop_unlock(i->mainloop);
 
-    return 0;
+    return r;
 }
 
 static int dsp_trigger(fd_info *i) {
@@ -1862,7 +1864,7 @@ fail:
 
     pa_threaded_mainloop_unlock(i->mainloop);
 
-    return 0;
+    return r;
 }
 
 static int dsp_cork(fd_info *i, pa_stream *s, int b) {
@@ -1900,7 +1902,7 @@ fail:
 
     pa_threaded_mainloop_unlock(i->mainloop);
 
-    return 0;
+    return r;
 }
 
 static int dsp_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno) {
@@ -2382,15 +2384,15 @@ int access(const char *pathname, int mode) {
     debug(DEBUG_LEVEL_VERBOSE, __FILE__": access(%s)\n", pathname?pathname:"NULL");
 
     if (!pathname ||
-        ( strcmp(pathname, "/dev/dsp") != 0 &&
-          strcmp(pathname, "/dev/adsp") != 0 &&
-          strcmp(pathname, "/dev/sndstat") != 0 &&
-          strcmp(pathname, "/dev/mixer") != 0 )) {
+        (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)) {
+    if (mode & X_OK) {
         debug(DEBUG_LEVEL_NORMAL, __FILE__": access(%s, %x) = EACCESS\n", pathname, mode);
         errno = EACCES;
         return -1;