termux-packages/packages/pulseaudio/fix-paths.patch

133 lines
5.7 KiB
Diff

diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c
index 3d63ea608..4c7ca228a 100644
--- a/src/modules/echo-cancel/module-echo-cancel.c
+++ b/src/modules/echo-cancel/module-echo-cancel.c
@@ -2067,18 +2067,18 @@ int pa__init(pa_module*m) {
}
if (u->save_aec) {
- pa_log("Creating AEC files in /tmp");
- u->captured_file = fopen("/tmp/aec_rec.sw", "wb");
+ pa_log("Creating AEC files in @TERMUX_PREFIX@/tmp");
+ u->captured_file = fopen("@TERMUX_PREFIX@/tmp/aec_rec.sw", "wb");
if (u->captured_file == NULL)
perror ("fopen failed");
- u->played_file = fopen("/tmp/aec_play.sw", "wb");
+ u->played_file = fopen("@TERMUX_PREFIX@/tmp/aec_play.sw", "wb");
if (u->played_file == NULL)
perror ("fopen failed");
- u->canceled_file = fopen("/tmp/aec_out.sw", "wb");
+ u->canceled_file = fopen("@TERMUX_PREFIX@/tmp/aec_out.sw", "wb");
if (u->canceled_file == NULL)
perror ("fopen failed");
if (u->ec->params.drift_compensation) {
- u->drift_file = fopen("/tmp/aec_drift.txt", "w");
+ u->drift_file = fopen("@TERMUX_PREFIX@/tmp/aec_drift.txt", "w");
if (u->drift_file == NULL)
perror ("fopen failed");
}
diff --git a/src/modules/module-pipe-source.c b/src/modules/module-pipe-source.c
index 32b35c163..eefd19861 100644
--- a/src/modules/module-pipe-source.c
+++ b/src/modules/module-pipe-source.c
@@ -59,7 +59,7 @@ PA_MODULE_USAGE(
"channels=<number of channels> "
"channel_map=<channel map>");
-#define DEFAULT_FILE_NAME "/tmp/music.input"
+#define DEFAULT_FILE_NAME "@TERMUX_PREFIX@/tmp/music.input"
#define DEFAULT_SOURCE_NAME "fifo_input"
struct userdata {
diff --git a/src/modules/module-protocol-stub.c b/src/modules/module-protocol-stub.c
index 5dd3fe079..b651b0c9b 100644
--- a/src/modules/module-protocol-stub.c
+++ b/src/modules/module-protocol-stub.c
@@ -303,13 +303,13 @@ int pa__init(pa_module*m) {
/* Windows doesn't support getuid(), so we ignore the per-user Esound socket compile flag.
* Moreover, Esound Unix sockets haven't been supported on Windows historically. */
# if defined(USE_PER_USER_ESOUND_SOCKET) && !defined(OS_IS_WIN32)
- u->socket_path = pa_sprintf_malloc("/tmp/.esd-%lu/socket", (unsigned long) getuid());
+ u->socket_path = pa_sprintf_malloc("@TERMUX_PREFIX@/tmp/.esd-%lu/socket", (unsigned long) getuid());
# else
- u->socket_path = pa_xstrdup("/tmp/.esd/socket");
+ u->socket_path = pa_xstrdup("@TERMUX_PREFIX@/tmp/.esd/socket");
# endif
/* This socket doesn't reside in our own runtime dir but in
- * /tmp/.esd/, hence we have to create the dir first */
+ * @TERMUX_PREFIX@/tmp/.esd/, hence we have to create the dir first */
if (pa_make_secure_parent_dir(u->socket_path, pa_in_system_mode() ? 0755U : 0700U, (uid_t)-1, (gid_t)-1, false) < 0) {
pa_log("Failed to create socket directory '%s': %s\n", u->socket_path, pa_cstrerror(errno));
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index c383a61c0..a5da743eb 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -1765,7 +1765,7 @@ char *pa_get_runtime_dir(void) {
* users, too. Since we need POSIX locking and UNIX sockets in
* this directory, we try XDG_RUNTIME_DIR first, and if that isn't
* set create a directory in $HOME and link it to a random subdir
- * in /tmp, if it was not explicitly configured. */
+ * in @TERMUX_PREFIX@/tmp, if it was not explicitly configured. */
m = pa_in_system_mode() ? 0755U : 0700U;
@@ -1838,7 +1838,7 @@ char *pa_get_runtime_dir(void) {
#ifdef HAVE_SYMLINK
/* Hmm, so the runtime directory didn't exist yet, so let's
- * create one in /tmp and symlink that to it */
+ * create one in @TERMUX_PREFIX@/tmp and symlink that to it */
if (make_random_dir_and_link(0700, k) < 0) {
@@ -3228,8 +3228,8 @@ char *pa_machine_id(void) {
if ((f = pa_fopen_cloexec(PA_MACHINE_ID, "r")) ||
(f = pa_fopen_cloexec(PA_MACHINE_ID_FALLBACK, "r")) ||
#if !defined(OS_IS_WIN32)
- (f = pa_fopen_cloexec("/etc/machine-id", "r")) ||
- (f = pa_fopen_cloexec("/var/lib/dbus/machine-id", "r"))
+ (f = pa_fopen_cloexec("@TERMUX_PREFIX@/etc/machine-id", "r")) ||
+ (f = pa_fopen_cloexec("@TERMUX_PREFIX@/var/lib/dbus/machine-id", "r"))
#else
false
#endif
@@ -3594,7 +3594,7 @@ const char *pa_get_temp_dir(void) {
pa_is_path_absolute(t))
return t;
- return "/tmp";
+ return "@TERMUX_PREFIX@/tmp";
}
int pa_open_cloexec(const char *fn, int flags, mode_t mode) {
diff --git a/src/pulsecore/esound.h b/src/pulsecore/esound.h
index 4ca0e0424..032298bd3 100644
--- a/src/pulsecore/esound.h
+++ b/src/pulsecore/esound.h
@@ -23,8 +23,8 @@
/* Most of the following is blatantly stolen from esound. */
/* path and name of the default EsounD domain socket */
-#define ESD_UNIX_SOCKET_DIR "/tmp/.esd"
-#define ESD_UNIX_SOCKET_NAME "/tmp/.esd/socket"
+#define ESD_UNIX_SOCKET_DIR "@TERMUX_PREFIX@/tmp/.esd"
+#define ESD_UNIX_SOCKET_NAME "@TERMUX_PREFIX@/tmp/.esd/socket"
/* length of the audio buffer size */
#define ESD_BUF_SIZE (4 * 1024)
diff --git a/src/pulsecore/shm.c b/src/pulsecore/shm.c
index e464f6bce..e37e1b388 100644
--- a/src/pulsecore/shm.c
+++ b/src/pulsecore/shm.c
@@ -67,7 +67,7 @@
/* On Linux we know that the shared memory blocks are files in
* /dev/shm. We can use that information to list all blocks and
* cleanup unused ones */
-#define SHM_PATH "/dev/shm/"
+#define SHM_PATH "@TERMUX_PREFIX@/tmp/"
#define SHM_ID_LEN 10
#elif defined(__sun)
#define SHM_PATH "/tmp"