aboutsummaryrefslogtreecommitdiffstats
path: root/src/firejail/pulseaudio.c
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2016-11-12 09:52:53 -0500
committerLibravatar netblue30 <netblue30@yahoo.com>2016-11-12 09:52:53 -0500
commit3ed5918832344db694d094eefbe2189fd847345d (patch)
treebdc2d85eb7e31c0eebf1a572a6996168f1b74b50 /src/firejail/pulseaudio.c
parenttesting (diff)
downloadfirejail-3ed5918832344db694d094eefbe2189fd847345d.tar.gz
firejail-3ed5918832344db694d094eefbe2189fd847345d.tar.zst
firejail-3ed5918832344db694d094eefbe2189fd847345d.zip
set_perms cleanup
Diffstat (limited to 'src/firejail/pulseaudio.c')
-rw-r--r--src/firejail/pulseaudio.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/firejail/pulseaudio.c b/src/firejail/pulseaudio.c
index e1a58c1c8..c76505591 100644
--- a/src/firejail/pulseaudio.c
+++ b/src/firejail/pulseaudio.c
@@ -106,10 +106,8 @@ void pulseaudio_init(void) {
106 // create the new user pulseaudio directory 106 // create the new user pulseaudio directory
107 int rv = mkdir(RUN_PULSE_DIR, 0700); 107 int rv = mkdir(RUN_PULSE_DIR, 0700);
108 (void) rv; // in --chroot mode the directory can already be there 108 (void) rv; // in --chroot mode the directory can already be there
109 if (chown(RUN_PULSE_DIR, getuid(), getgid()) < 0) 109 if (set_perms(RUN_PULSE_DIR, getuid(), getgid(), 0700))
110 errExit("chown"); 110 errExit("set_perms");
111 if (chmod(RUN_PULSE_DIR, 0700) < 0)
112 errExit("chmod");
113 111
114 // create the new client.conf file 112 // create the new client.conf file
115 char *pulsecfg = NULL; 113 char *pulsecfg = NULL;
@@ -131,10 +129,8 @@ void pulseaudio_init(void) {
131 if (stat(dir1, &s) == -1) { 129 if (stat(dir1, &s) == -1) {
132 int rv = mkdir(dir1, 0755); 130 int rv = mkdir(dir1, 0755);
133 if (rv == 0) { 131 if (rv == 0) {
134 rv = chown(dir1, getuid(), getgid()); 132 if (set_perms(dir1, getuid(), getgid(), 0755))
135 (void) rv; 133 ; // do nothing
136 rv = chmod(dir1, 0755);
137 (void) rv;
138 } 134 }
139 } 135 }
140 free(dir1); 136 free(dir1);
@@ -143,10 +139,8 @@ void pulseaudio_init(void) {
143 if (stat(dir1, &s) == -1) { 139 if (stat(dir1, &s) == -1) {
144 int rv = mkdir(dir1, 0700); 140 int rv = mkdir(dir1, 0700);
145 if (rv == 0) { 141 if (rv == 0) {
146 rv = chown(dir1, getuid(), getgid()); 142 if (set_perms(dir1, getuid(), getgid(), 0700))
147 (void) rv; 143 ; // do nothing
148 rv = chmod(dir1, 0700);
149 (void) rv;
150 } 144 }
151 } 145 }
152 free(dir1); 146 free(dir1);