From cc34d9759c418d75e3d9a9d6e45fb2e440378777 Mon Sep 17 00:00:00 2001 From: avoidr Date: Fri, 20 Nov 2015 00:33:42 +0100 Subject: keep original file permissions --- src/firejail/fs_whitelist.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/firejail/fs_whitelist.c b/src/firejail/fs_whitelist.c index fccb82735..740bdab3e 100644 --- a/src/firejail/fs_whitelist.c +++ b/src/firejail/fs_whitelist.c @@ -27,12 +27,9 @@ #include #include -static int mkpath(const char* path) { +static int mkpath(const char* path, mode_t mode) { assert(path && *path); - // create directories with a 0755 mode - mode_t mode = 0755; - // create directories with uid/gid as root or as current user if inside home directory uid_t uid = getuid(); gid_t gid = getgid(); @@ -142,7 +139,7 @@ static void whitelist_path(ProfileEntry *entry) { } // create the path if necessary - mkpath(path); + mkpath(path, s.st_mode); // process directory if (S_ISDIR(s.st_mode)) { @@ -417,7 +414,7 @@ void fs_whitelist(void) { struct stat s; if (stat(entry->link, &s) != 0) { // create the path if necessary - mkpath(entry->link); + mkpath(entry->link, s.st_mode); int rv = symlink(entry->data + 10, entry->link); if (rv) -- cgit v1.2.3-70-g09d2