diff options
author | 2019-11-19 14:59:02 +0100 | |
---|---|---|
committer | 2019-11-19 14:59:02 +0100 | |
commit | 68296989da35a0d5579a83f465aa751524bbbb4f (patch) | |
tree | 3f9c46c8d5154d302a82bda00300affad27da9ac | |
parent | fix previous commit (diff) | |
download | firejail-68296989da35a0d5579a83f465aa751524bbbb4f.tar.gz firejail-68296989da35a0d5579a83f465aa751524bbbb4f.tar.zst firejail-68296989da35a0d5579a83f465aa751524bbbb4f.zip |
improving remount performance
-rw-r--r-- | src/firejail/fs.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/firejail/fs.c b/src/firejail/fs.c index 1f0ccac1a..7b5200d1c 100644 --- a/src/firejail/fs.c +++ b/src/firejail/fs.c | |||
@@ -535,6 +535,14 @@ void fs_remount(const char *dir, OPERATION op, unsigned check_mnt) { | |||
535 | 535 | ||
536 | void fs_remount_rec(const char *dir, OPERATION op, unsigned check_mnt) { | 536 | void fs_remount_rec(const char *dir, OPERATION op, unsigned check_mnt) { |
537 | assert(dir); | 537 | assert(dir); |
538 | struct stat s; | ||
539 | if (stat(dir, &s) != 0) | ||
540 | return; | ||
541 | if (!S_ISDIR(s.st_mode)) { | ||
542 | // no need to search in /proc/self/mountinfo for submounts if not a directory | ||
543 | fs_remount(dir, op, check_mnt); | ||
544 | return; | ||
545 | } | ||
538 | // get mount point of the directory | 546 | // get mount point of the directory |
539 | int mountid = get_mount_id(dir); | 547 | int mountid = get_mount_id(dir); |
540 | if (mountid == -1) | 548 | if (mountid == -1) |