[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.17-16-g7b76ea3

Lennart Poettering gitmailer-noreply at 0pointer.de
Thu Sep 17 12:09:34 PDT 2009


This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.

The master branch has been updated
      from  b4d4f2b856cd0d5e24f777a088b9d4462567dac0 (commit)

- Log -----------------------------------------------------------------
7b76ea3 core-util: unify how we determine the temporary directory
2d9168c Improve TMPDIR handling
3de5c49 cli: properly destruct cli object
-----------------------------------------------------------------------

Summary of changes:
 src/modules/module-cli.c  |    4 ++--
 src/pulsecore/core-util.c |   33 +++++++++++++++++++++++----------
 src/pulsecore/core-util.h |    2 ++
 src/utils/padsp.c         |    6 +++++-
 4 files changed, 32 insertions(+), 13 deletions(-)

-----------------------------------------------------------------------

commit 3de5c49e4289bb646919bdced6fccb82ced51ad0
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Sep 17 04:04:54 2009 +0200

    cli: properly destruct cli object

diff --git a/src/modules/module-cli.c b/src/modules/module-cli.c
index 60a9d46..6bd0f4f 100644
--- a/src/modules/module-cli.c
+++ b/src/modules/module-cli.c
@@ -93,7 +93,7 @@ int pa__init(pa_module*m) {
     }
 
     if (pa_stdio_acquire() < 0) {
-        pa_log("STDIN/STDUSE already in use.");
+        pa_log("STDIN/STDOUT already in use.");
         goto fail;
     }
 
@@ -132,7 +132,7 @@ fail:
 void pa__done(pa_module*m) {
     pa_assert(m);
 
-    if (m->core->running_as_daemon == 0) {
+    if (m->userdata) {
         pa_cli_free(m->userdata);
         pa_stdio_release();
     }

commit 2d9168ceb388cbb6dba49cc3a531921f78ec3295
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Sep 17 20:58:36 2009 +0200

    Improve TMPDIR handling
    
    Patch from 'jnelson',
    
    http://pulseaudio.org/ticket/653

diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index 7a9f458..690f34c 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -1390,7 +1390,7 @@ static char* make_random_dir(mode_t m) {
     if (!tmpdir || !pa_is_path_absolute(tmpdir))
         tmpdir = "/tmp";
 
-    fn = pa_sprintf_malloc("%s/pulse-XXXXXXXXXXXX", tmpdir);
+    fn = pa_sprintf_malloc("%s" PA_PATH_SEP "pulse-XXXXXXXXXXXX", tmpdir);
     pathlen = strlen(fn);
 
     for (;;) {
diff --git a/src/utils/padsp.c b/src/utils/padsp.c
index 41bfd74..c8c0874 100644
--- a/src/utils/padsp.c
+++ b/src/utils/padsp.c
@@ -1394,10 +1394,21 @@ static int sndstat_open(int flags, int *_errno) {
         "Mixers:\n"
         "0: PulseAudio Virtual OSS\n";
 
-    char fn[] = "/tmp/padsp-sndstat-XXXXXX";
+    char *fn;
     mode_t u;
     int fd = -1;
     int e;
+    const char *tmpdir;
+
+    if (!(tmpdir = getenv("TMPDIR")))
+        if (!(tmpdir = getenv("TMP")))
+            if (!(tmpdir = getenv("TEMP")))
+                tmpdir = getenv("TEMPDIR");
+
+    if (!tmpdir || !pa_is_path_absolute(tmpdir))
+        tmpdir = "/tmp";
+
+    fn = pa_sprintf_malloc("%s" PA_PATH_SEP "padsp-sndstat-XXXXXX", tmpdir);
 
     debug(DEBUG_LEVEL_NORMAL, __FILE__": sndstat_open()\n");
 
@@ -1423,6 +1434,7 @@ static int sndstat_open(int flags, int *_errno) {
     }
 
     unlink(fn);
+    pa_xfree(fn);
 
     if (write(fd, sndstat, sizeof(sndstat) -1) != sizeof(sndstat)-1) {
         *_errno = errno;
@@ -1439,6 +1451,7 @@ static int sndstat_open(int flags, int *_errno) {
     return fd;
 
 fail:
+    pa_xfree(fn);
     if (fd >= 0)
         close(fd);
     return -1;

commit 7b76ea378460bf3e037dff90742f88f74ee70b11
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Sep 17 21:06:54 2009 +0200

    core-util: unify how we determine the temporary directory

diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index 690f34c..8e98e85 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -1378,19 +1378,10 @@ static char* make_random_dir(mode_t m) {
         "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
         "0123456789";
 
-    const char *tmpdir;
     char *fn;
     size_t pathlen;
 
-    if (!(tmpdir = getenv("TMPDIR")))
-        if (!(tmpdir = getenv("TMP")))
-            if (!(tmpdir = getenv("TEMP")))
-                tmpdir = getenv("TEMPDIR");
-
-    if (!tmpdir || !pa_is_path_absolute(tmpdir))
-        tmpdir = "/tmp";
-
-    fn = pa_sprintf_malloc("%s" PA_PATH_SEP "pulse-XXXXXXXXXXXX", tmpdir);
+    fn = pa_sprintf_malloc("%s" PA_PATH_SEP "pulse-XXXXXXXXXXXX", pa_get_temp_dir());
     pathlen = strlen(fn);
 
     for (;;) {
@@ -2854,3 +2845,25 @@ pa_bool_t pa_run_from_build_tree(void) {
 }
 
 #endif
+
+const char *pa_get_temp_dir(void) {
+    const char *t;
+
+    if ((t = getenv("TMPDIR")) &&
+        pa_is_path_absolute(t))
+        return t;
+
+    if ((t = getenv("TMP")) &&
+        pa_is_path_absolute(t))
+        return t;
+
+    if ((t = getenv("TEMP")) &&
+        pa_is_path_absolute(t))
+        return t;
+
+    if ((t = getenv("TEMPDIR")) &&
+        pa_is_path_absolute(t))
+        return t;
+
+    return "/tmp";
+}
diff --git a/src/pulsecore/core-util.h b/src/pulsecore/core-util.h
index ccc9a38..84752d4 100644
--- a/src/pulsecore/core-util.h
+++ b/src/pulsecore/core-util.h
@@ -249,4 +249,6 @@ void pa_reset_personality(void);
 pa_bool_t pa_run_from_build_tree(void);
 #endif
 
+const char *pa_get_temp_dir(void);
+
 #endif
diff --git a/src/utils/padsp.c b/src/utils/padsp.c
index c8c0874..2ed0a03 100644
--- a/src/utils/padsp.c
+++ b/src/utils/padsp.c
@@ -1398,17 +1398,8 @@ static int sndstat_open(int flags, int *_errno) {
     mode_t u;
     int fd = -1;
     int e;
-    const char *tmpdir;
 
-    if (!(tmpdir = getenv("TMPDIR")))
-        if (!(tmpdir = getenv("TMP")))
-            if (!(tmpdir = getenv("TEMP")))
-                tmpdir = getenv("TEMPDIR");
-
-    if (!tmpdir || !pa_is_path_absolute(tmpdir))
-        tmpdir = "/tmp";
-
-    fn = pa_sprintf_malloc("%s" PA_PATH_SEP "padsp-sndstat-XXXXXX", tmpdir);
+    fn = pa_sprintf_malloc("%s" PA_PATH_SEP "padsp-sndstat-XXXXXX", pa_get_temp_dir());
 
     debug(DEBUG_LEVEL_NORMAL, __FILE__": sndstat_open()\n");
 

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list