aboutsummaryrefslogtreecommitdiffstats
path: root/src/firejail/mountinfo.c
diff options
context:
space:
mode:
authorLibravatar smitsohu <smitsohu@gmail.com>2019-09-22 13:18:23 +0200
committerLibravatar smitsohu <smitsohu@gmail.com>2019-09-22 13:18:23 +0200
commitf82d9344dcef51a7306bbe718369b0015922e4f3 (patch)
tree28a8a07990d244c6797673973085fe839d0de2c1 /src/firejail/mountinfo.c
parentapparmor: permit writing to trace file (diff)
downloadfirejail-f82d9344dcef51a7306bbe718369b0015922e4f3.tar.gz
firejail-f82d9344dcef51a7306bbe718369b0015922e4f3.tar.zst
firejail-f82d9344dcef51a7306bbe718369b0015922e4f3.zip
various clarifications, minor fixes
Diffstat (limited to 'src/firejail/mountinfo.c')
-rw-r--r--src/firejail/mountinfo.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/firejail/mountinfo.c b/src/firejail/mountinfo.c
index 42e160dec..162f5dbec 100644
--- a/src/firejail/mountinfo.c
+++ b/src/firejail/mountinfo.c
@@ -225,9 +225,9 @@ char **build_mount_array(const int mount_id, const char *path) {
225 exit(1); 225 exit(1);
226 } 226 }
227 do { 227 do {
228 parse_line(buf, &mntp);
228 // find mount point with mount id 229 // find mount point with mount id
229 if (!found) { 230 if (!found) {
230 parse_line(buf, &mntp);
231 if (mntp.mountid == mount_id) { 231 if (mntp.mountid == mount_id) {
232 // give up if mount id has been reassigned, 232 // give up if mount id has been reassigned,
233 // don't remount blacklisted path 233 // don't remount blacklisted path
@@ -236,19 +236,17 @@ char **build_mount_array(const int mount_id, const char *path) {
236 strstr(mntp.fsname, "firejail.ro.file")) 236 strstr(mntp.fsname, "firejail.ro.file"))
237 break; 237 break;
238 238
239 rv[0] = strdup(path); 239 rv[cnt] = strdup(path);
240 if (rv[0] == NULL) 240 if (rv[cnt] == NULL)
241 errExit("strdup"); 241 errExit("strdup");
242 cnt++; 242 cnt++;
243 found = 1; 243 found = 1;
244 continue; 244 continue;
245 } 245 }
246 else 246 continue;
247 continue;
248 } 247 }
249 // from here on add all mount points below path, 248 // from here on add all mount points below path,
250 // don't remount blacklisted paths 249 // don't remount blacklisted paths
251 parse_line(buf, &mntp);
252 if (strncmp(mntp.dir, path, pathlen) == 0 && 250 if (strncmp(mntp.dir, path, pathlen) == 0 &&
253 mntp.dir[pathlen] == '/' && 251 mntp.dir[pathlen] == '/' &&
254 strstr(mntp.fsname, "firejail.ro.dir") == NULL && 252 strstr(mntp.fsname, "firejail.ro.dir") == NULL &&