From 265cd772fc7852d2deaacd886a26253006235d59 Mon Sep 17 00:00:00 2001 From: netblue30 Date: Fri, 5 Aug 2016 08:39:56 -0400 Subject: fix whitelist ~/deletme problem --- src/firejail/fs_whitelist.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/firejail/fs_whitelist.c b/src/firejail/fs_whitelist.c index f94040d0f..90b91f9dd 100644 --- a/src/firejail/fs_whitelist.c +++ b/src/firejail/fs_whitelist.c @@ -268,13 +268,17 @@ static void whitelist_path(ProfileEntry *entry) { // process regular file else { - // create an empty file - FILE *fp = fopen(path, "w"); - if (!fp) { - fprintf(stderr, "Error: cannot create empty file in home directory\n"); - exit(1); + if (access(path, R_OK)) { + // create an empty file + FILE *fp = fopen(path, "w"); + if (!fp) { + fprintf(stderr, "Error: cannot create empty file in home directory\n"); + exit(1); + } + fclose(fp); } - fclose(fp); + else + return; // the file is already present } // set file properties -- cgit v1.2.3-70-g09d2