diff options
author | netblue30 <netblue30@yahoo.com> | 2016-07-08 08:20:10 -0400 |
---|---|---|
committer | netblue30 <netblue30@yahoo.com> | 2016-07-08 08:20:10 -0400 |
commit | 96d8a03c886e67291aff4973582c96f4ba2a4955 (patch) | |
tree | ea83a438f67f3bf2319203964b2f882e7c4f0732 /src | |
parent | Merge pull request #621 from Fred-Barclay/proposed (diff) | |
download | firejail-96d8a03c886e67291aff4973582c96f4ba2a4955.tar.gz firejail-96d8a03c886e67291aff4973582c96f4ba2a4955.tar.zst firejail-96d8a03c886e67291aff4973582c96f4ba2a4955.zip |
pulseaudio fix
Diffstat (limited to 'src')
-rw-r--r-- | src/firejail/pulseaudio.c | 20 |
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 | ||