diff options
Diffstat (limited to 'src/firejail/fs_whitelist.c')
-rw-r--r-- | src/firejail/fs_whitelist.c | 16 |
1 files changed, 10 insertions, 6 deletions
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) { | |||
268 | 268 | ||
269 | // process regular file | 269 | // process regular file |
270 | else { | 270 | else { |
271 | // create an empty file | 271 | if (access(path, R_OK)) { |
272 | FILE *fp = fopen(path, "w"); | 272 | // create an empty file |
273 | if (!fp) { | 273 | FILE *fp = fopen(path, "w"); |
274 | fprintf(stderr, "Error: cannot create empty file in home directory\n"); | 274 | if (!fp) { |
275 | exit(1); | 275 | fprintf(stderr, "Error: cannot create empty file in home directory\n"); |
276 | exit(1); | ||
277 | } | ||
278 | fclose(fp); | ||
276 | } | 279 | } |
277 | fclose(fp); | 280 | else |
281 | return; // the file is already present | ||
278 | } | 282 | } |
279 | 283 | ||
280 | // set file properties | 284 | // set file properties |