Fix previous commit... 'Maintainer' field can only have one entry
[osspd.git] / debian / patches / Hack-to-work-with-modern-PulseAudio.patch
1 From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
2 Date: Fri, 18 Dec 2020 23:17:36 +0000
3 Subject: [PATCH] Hack to work with modern PulseAudio
4
5 ---
6  ossp-padsp.c | 8 ++++++++
7  1 file changed, 8 insertions(+)
8
9 diff --git a/ossp-padsp.c b/ossp-padsp.c
10 index c505b57..b4ac097 100644
11 --- a/ossp-padsp.c
12 +++ b/ossp-padsp.c
13 @@ -22,6 +22,8 @@
14  #include <sys/stat.h>
15  #include <sys/types.h>
16  #include <unistd.h>
17 +#include <linux/limits.h>
18 +#include <stdlib.h>
19  
20  #include <pulse/pulseaudio.h>
21  #include <sys/soundcard.h>
22 @@ -1478,9 +1480,15 @@ static void action_post(void)
23  int main(int argc, char **argv)
24  {
25         int rc;
26 +       static char runtime_dir[PATH_MAX];
27  
28         ossp_slave_init(argc, argv);
29  
30 +       snprintf(runtime_dir, sizeof runtime_dir, "/run/user/%llu",
31 +               (long long unsigned) getuid());
32 +       if (access(runtime_dir, R_OK | X_OK) == 0)
33 +               setenv("XDG_RUNTIME_DIR", runtime_dir, 0);
34 +
35         page_size = sysconf(_SC_PAGE_SIZE);
36  
37         mainloop = pa_threaded_mainloop_new();