diff options
author | smitsohu <smitsohu@gmail.com> | 2021-06-08 18:24:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-08 18:24:22 +0200 |
commit | 5e30eb49355f5620cc2f99100a0890cfed02ccd4 (patch) | |
tree | 0852f5402f9785dc1ebdd236eb31a9c40b02adf4 /src/firejail/pulseaudio.c | |
parent | fixup 9678da00301562464464099b9d7cfd76424fbb23 (diff) | |
parent | add more EUID switching (diff) | |
download | firejail-5e30eb49355f5620cc2f99100a0890cfed02ccd4.tar.gz firejail-5e30eb49355f5620cc2f99100a0890cfed02ccd4.tar.zst firejail-5e30eb49355f5620cc2f99100a0890cfed02ccd4.zip |
Merge pull request #4349 from smitsohu/misc
Misc hardening + refactoring
Diffstat (limited to 'src/firejail/pulseaudio.c')
-rw-r--r-- | src/firejail/pulseaudio.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/firejail/pulseaudio.c b/src/firejail/pulseaudio.c index 1b01a71c6..be0f5aea6 100644 --- a/src/firejail/pulseaudio.c +++ b/src/firejail/pulseaudio.c | |||
@@ -158,17 +158,13 @@ void pulseaudio_init(void) { | |||
158 | // mount via the link in /proc/self/fd | 158 | // mount via the link in /proc/self/fd |
159 | if (arg_debug) | 159 | if (arg_debug) |
160 | printf("Mounting %s on %s\n", RUN_PULSE_DIR, homeusercfg); | 160 | printf("Mounting %s on %s\n", RUN_PULSE_DIR, homeusercfg); |
161 | char *proc; | 161 | if (bind_mount_path_to_fd(RUN_PULSE_DIR, fd)) |
162 | if (asprintf(&proc, "/proc/self/fd/%d", fd) == -1) | ||
163 | errExit("asprintf"); | ||
164 | if (mount(RUN_PULSE_DIR, proc, "none", MS_BIND, NULL) < 0) | ||
165 | errExit("mount pulseaudio"); | 162 | errExit("mount pulseaudio"); |
166 | // check /proc/self/mountinfo to confirm the mount is ok | 163 | // check /proc/self/mountinfo to confirm the mount is ok |
167 | MountData *mptr = get_last_mount(); | 164 | MountData *mptr = get_last_mount(); |
168 | if (strcmp(mptr->dir, homeusercfg) != 0 || strcmp(mptr->fstype, "tmpfs") != 0) | 165 | if (strcmp(mptr->dir, homeusercfg) != 0 || strcmp(mptr->fstype, "tmpfs") != 0) |
169 | errLogExit("invalid pulseaudio mount"); | 166 | errLogExit("invalid pulseaudio mount"); |
170 | fs_logger2("tmpfs", homeusercfg); | 167 | fs_logger2("tmpfs", homeusercfg); |
171 | free(proc); | ||
172 | close(fd); | 168 | close(fd); |
173 | 169 | ||
174 | char *p; | 170 | char *p; |