diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/sandbox.c | 2 | ||||
-rw-r--r-- | src/common/storagedir.c | 21 | ||||
-rw-r--r-- | src/common/storagedir.h | 1 |
3 files changed, 18 insertions, 6 deletions
diff --git a/src/common/sandbox.c b/src/common/sandbox.c index ddb1f02b05..ab2de52592 100644 --- a/src/common/sandbox.c +++ b/src/common/sandbox.c @@ -20,7 +20,7 @@ #endif /** Malloc mprotect limit in bytes. */ -#define MALLOC_MP_LIM 1048576 +#define MALLOC_MP_LIM (16*1024*1024) #include <stdio.h> #include <string.h> diff --git a/src/common/storagedir.c b/src/common/storagedir.c index 7e0be6754b..309d42db17 100644 --- a/src/common/storagedir.c +++ b/src/common/storagedir.c @@ -89,11 +89,12 @@ storage_dir_register_with_sandbox(storage_dir_t *d, sandbox_cfg_t **cfg) tor_asprintf(&path, "%s/%d", d->directory, idx); tor_asprintf(&tmppath, "%s/%d.tmp", d->directory, idx); - problems += sandbox_cfg_allow_open_filename(cfg, path); - problems += sandbox_cfg_allow_open_filename(cfg, tmppath); - problems += sandbox_cfg_allow_stat_filename(cfg, path); - problems += sandbox_cfg_allow_stat_filename(cfg, tmppath); - problems += sandbox_cfg_allow_rename(cfg, tmppath, path); + problems += sandbox_cfg_allow_open_filename(cfg, tor_strdup(path)); + problems += sandbox_cfg_allow_open_filename(cfg, tor_strdup(tmppath)); + problems += sandbox_cfg_allow_stat_filename(cfg, tor_strdup(path)); + problems += sandbox_cfg_allow_stat_filename(cfg, tor_strdup(tmppath)); + problems += sandbox_cfg_allow_rename(cfg, + tor_strdup(tmppath), tor_strdup(path)); tor_free(path); tor_free(tmppath); @@ -529,3 +530,13 @@ storage_dir_remove_all(storage_dir_t *d) return storage_dir_shrink(d, 0, d->max_files); } +/** + * Return the largest number of non-temporary files we're willing to + * store in <b>d</b>. + */ +int +storage_dir_get_max_files(storage_dir_t *d) +{ + return d->max_files; +} + diff --git a/src/common/storagedir.h b/src/common/storagedir.h index 781194407f..db25057e65 100644 --- a/src/common/storagedir.h +++ b/src/common/storagedir.h @@ -45,6 +45,7 @@ int storage_dir_shrink(storage_dir_t *d, uint64_t target_size, int min_to_remove); int storage_dir_remove_all(storage_dir_t *d); +int storage_dir_get_max_files(storage_dir_t *d); #endif |