aboutsummaryrefslogtreecommitdiffstats
path: root/src/firejail/pulseaudio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/firejail/pulseaudio.c')
-rw-r--r--src/firejail/pulseaudio.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/firejail/pulseaudio.c b/src/firejail/pulseaudio.c
index 767aaab09..908ef1d25 100644
--- a/src/firejail/pulseaudio.c
+++ b/src/firejail/pulseaudio.c
@@ -56,13 +56,27 @@ void pulseaudio_disable(void) {
56 // blacklist user config directory 56 // blacklist user config directory
57 disable_file(cfg.homedir, ".config/pulse"); 57 disable_file(cfg.homedir, ".config/pulse");
58 58
59
60 // blacklist pulseaudio socket in XDG_RUNTIME_DIR
61 char *name = getenv("XDG_RUNTIME_DIR");
62 if (name)
63 disable_file(name, "pulse/native");
64
65 // try the default location anyway
66 char *path;
67 if (asprintf(&path, "/run/user/%d", getuid()) == -1)
68 errExit("asprintf");
69 disable_file(path, "pulse/native");
70 free(path);
71
72
73
59 // blacklist any pulse* file in /tmp directory 74 // blacklist any pulse* file in /tmp directory
60 DIR *dir; 75 DIR *dir;
61 if (!(dir = opendir("/tmp"))) { 76 if (!(dir = opendir("/tmp"))) {
62 // sleep 2 seconds and try again 77 // sleep 2 seconds and try again
63 sleep(2); 78 sleep(2);
64 if (!(dir = opendir("/tmp"))) { 79 if (!(dir = opendir("/tmp"))) {
65 fprintf(stderr, "Warning: cannot open /tmp directory. PulseAudio sockets are not disabled\n");
66 return; 80 return;
67 } 81 }
68 } 82 }
@@ -76,10 +90,6 @@ void pulseaudio_disable(void) {
76 90
77 closedir(dir); 91 closedir(dir);
78 92
79 // blacklist XDG_RUNTIME_DIR
80 char *name = getenv("XDG_RUNTIME_DIR");
81 if (name)
82 disable_file(name, "pulse/native");
83} 93}
84 94
85 95