Don't create unused import folder

This commit is contained in:
Jeremy Lakeman 2013-07-03 10:54:05 +09:30
parent 5257ac9ca8
commit 8249f65f8f
3 changed files with 0 additions and 32 deletions

View File

@ -187,9 +187,6 @@ const char *rhizome_datastore_path();
int form_rhizome_datastore_path(char * buf, size_t bufsiz, const char *fmt, ...);
int create_rhizome_datastore_dir();
int form_rhizome_import_path(char * buf, size_t bufsiz, const char *fmt, ...);
int create_rhizome_import_dir();
/* Handy statement for forming the path of a rhizome store file in a char buffer whose declaration
* is in scope (so that sizeof(buf) will work). Evaluates to true if the pathname fitted into
* the provided buffer, false (0) otherwise (after logging an error). */

View File

@ -63,39 +63,12 @@ int form_rhizome_datastore_path(char * buf, size_t bufsiz, const char *fmt, ...)
return 1;
}
int form_rhizome_import_path(char * buf, size_t bufsiz, const char *fmt, ...)
{
va_list ap;
strbuf b = strbuf_local(buf, bufsiz);
strbuf_sprintf(b, "%s/import", rhizome_datastore_path());
if (fmt) {
va_start(ap, fmt);
strbuf_putc(b, '/');
strbuf_vsprintf(b, fmt, ap);
va_end(ap);
}
if (strbuf_overrun(b)) {
WHY("Path buffer overrun");
return 0;
}
return 1;
}
int create_rhizome_datastore_dir()
{
if (config.debug.rhizome) DEBUGF("mkdirs(%s, 0700)", rhizome_datastore_path());
return emkdirs(rhizome_datastore_path(), 0700);
}
int create_rhizome_import_dir()
{
char dirname[1024];
if (!form_rhizome_import_path(dirname, sizeof dirname, NULL))
return -1;
if (config.debug.rhizome) DEBUGF("mkdirs(%s, 0700)", dirname);
return emkdirs(dirname, 0700);
}
sqlite3 *rhizome_db=NULL;
/* XXX Requires a messy join that might be slow. */

View File

@ -543,8 +543,6 @@ static int schedule_fetch(struct rhizome_fetch_slot *slot)
slot->write_state.blob_fd=-1;
slot->write_state.blob_rowid=-1;
if (create_rhizome_import_dir() == -1)
RETURN(WHY("Unable to create import directory"));
if (slot->manifest) {
if (rhizome_open_write(&slot->write_state, slot->manifest->fileHexHash, slot->manifest->fileLength, RHIZOME_PRIORITY_DEFAULT))
RETURN(-1);