diff options
author | Vincent Sanders <vince@kyllikki.org> | 2014-11-19 16:26:29 +0000 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2014-11-19 16:26:29 +0000 |
commit | 69f4397fe4c438063ac6b80e43749b5de10a4e68 (patch) | |
tree | 0eacef8ab89be37f5f49fc568bb469bfe56fb64e /content/fs_backing_store.c | |
parent | 92a1ac4fbbb2d3046cd6f27364e09f765bc2bf49 (diff) | |
download | netsurf-69f4397fe4c438063ac6b80e43749b5de10a4e68.tar.gz netsurf-69f4397fe4c438063ac6b80e43749b5de10a4e68.tar.bz2 |
Limit creation of store path directories.
Only create all elements of a path in the store when it is being
opened for creation instead of causing reads to create directories.
Diffstat (limited to 'content/fs_backing_store.c')
-rw-r--r-- | content/fs_backing_store.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/content/fs_backing_store.c b/content/fs_backing_store.c index 83bd2a923..ba365a222 100644 --- a/content/fs_backing_store.c +++ b/content/fs_backing_store.c @@ -152,7 +152,6 @@ struct store_state { struct store_state *storestate; - /** * Remove a backing store entry from the entry table. * @@ -255,7 +254,7 @@ store_fname(struct store_state *state, { char *fname = NULL; uint8_t b32u_i[8]; /* base32 encoded ident */ - uint8_t b32u_d[6][2]; /* base64 ident as separate components */ + uint8_t b32u_d[6][2]; /* base32 ident as separate components */ const char *dat; /* RFC4648 base32 encoding table */ @@ -723,13 +722,14 @@ store_open(struct store_state *state, return -1; } - /** @todo mkdir only on write flag */ - /* ensure path to file is usable */ - ret = netsurf_mkdir_all(fname); - if (ret != NSERROR_OK) { - LOG(("file path \"%s\" could not be created", fname)); - free(fname); - return -1; + /* ensure all path elements to file exist if creating file */ + if (openflags & O_CREAT) { + ret = netsurf_mkdir_all(fname); + if (ret != NSERROR_OK) { + LOG(("file path \"%s\" could not be created", fname)); + free(fname); + return -1; + } } LOG(("opening %s", fname)); @@ -1056,6 +1056,7 @@ initialise(const struct llcache_store_parameters *parameters) newstate->entry_bits = parameters->entry_size; } + /* read store control and create new if required */ ret = read_control(newstate); if (ret != NSERROR_OK) { LOG(("read control failed %s", messages_get_errorcode(ret))); |