Fix bug in rhizome_bundle_import()

Introduced by recent rhizome import path improvements
This commit is contained in:
Andrew Bettison 2012-05-24 13:00:31 +09:30
parent 24c00091f5
commit 3b00110c49
2 changed files with 6 additions and 4 deletions

View File

@ -33,13 +33,16 @@ int rhizome_bundle_import(rhizome_manifest *m_in, rhizome_manifest **m_out,
char *groups[], int ttl,
int verifyP, int checkFileP, int signP)
{
if (debug&DEBUG_RHIZOMESYNC)
DEBUGF("rhizome_bundle_import(m_in=%p, m_out=%p, bundle=%s, groups=%p, ttl=%d, verifyP=%d, checkFileP=%d, signP=%d)",
m_in, m_out, bundle ? bundle : "(null)", groups, ttl, verifyP, checkFileP, signP);
if (m_out) *m_out = NULL;
char filename[1024];
char manifestname[1024];
/* make sure import path exists */
if (!create_rhizome_import_dir())
if (create_rhizome_import_dir() == -1)
return -1;
if (!FORM_RHIZOME_IMPORT_PATH(filename, "file.%s", bundle)
@ -54,7 +57,7 @@ int rhizome_bundle_import(rhizome_manifest *m_in, rhizome_manifest **m_out,
return WHY("Could not read manifest file.");
} else {
if (debug&DEBUG_RHIZOMESYNC)
WHYF("Importing direct from manifest structure fileHashedP=%d", m->fileHashedP);
DEBUGF("Importing direct from manifest structure fileHashedP=%d", m->fileHashedP);
}
/* Add the manifest and its associated file to the Rhizome database. */

View File

@ -806,7 +806,7 @@ int rhizome_fetch_poll()
}
q->manifest->finalised=1;
q->manifest->manifest_bytes=q->manifest->manifest_all_bytes;
if (!rhizome_write_manifest_file(q->manifest,filename)) {
if (rhizome_write_manifest_file(q->manifest,filename) != -1) {
rhizome_bundle_import(q->manifest, NULL, id,
NULL /* no additional groups */,
q->manifest->ttl - 1 /* TTL */,
@ -815,7 +815,6 @@ int rhizome_fetch_poll()
0 /* do not sign it, just keep existing signatures */);
q->manifest=NULL;
} else {
WHY("rhizome_write_manifest_file() failed");
rhizome_manifest_free(q->manifest);
q->manifest=NULL;
}