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 (;;) {
"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");
}
unlink(fn);
+ pa_xfree(fn);
if (write(fd, sndstat, sizeof(sndstat) -1) != sizeof(sndstat)-1) {
*_errno = errno;
return fd;
fail:
+ pa_xfree(fn);
if (fd >= 0)
close(fd);
return -1;