Fix bug in "rhizome add file" command

Was not opening keyring file properly
This commit is contained in:
Andrew Bettison 2012-05-20 15:25:19 +09:30
parent 990db1d275
commit 41583c1011
2 changed files with 10 additions and 11 deletions

View File

@ -1083,7 +1083,7 @@ int app_rhizome_add_file(int argc, const char *const *argv, struct command_line_
cli_arg(argc, argv, o, "manifestpath", &manifestpath, NULL, "");
if (create_serval_instance_dir() == -1)
return -1;
if (!keyring_open_with_pins(pin))
if (!(keyring = keyring_open_with_pins((char *)pin)))
return -1;
if (rhizome_opendb() == -1)
return -1;
@ -1323,8 +1323,7 @@ int app_keyring_set_did(int argc, const char *const *argv, struct command_line_o
if (strlen(did)>31) return WHY("DID too long (31 digits max)");
if (strlen(name)>63) return WHY("Name too long (31 char max)");
keyring = keyring_open_with_pins((char *)pin);
if (!keyring)
if (!(keyring = keyring_open_with_pins((char *)pin)))
return -1;
unsigned char packedSid[SID_SIZE];

View File

@ -1360,15 +1360,15 @@ int keyring_enter_pins(keyring_file *k, const char *pinlist)
keyring_file *keyring_open_with_pins(const char *pinlist)
{
keyring_file *k = NULL;
if (create_serval_instance_dir() == -1)
if (create_serval_instance_dir() == -1)
return NULL;
char keyringFile[1024];
if (!FORM_SERVAL_INSTANCE_PATH(keyringFile, "serval.keyring"))
return NULL;
if ((k = keyring_open(keyringFile)) == NULL)
return NULL;
keyring_enter_pins(k,pinlist);
return k;
char keyringFile[1024];
if (!FORM_SERVAL_INSTANCE_PATH(keyringFile, "serval.keyring"))
return NULL;
if ((k = keyring_open(keyringFile)) == NULL)
return NULL;
keyring_enter_pins(k,pinlist);
return k;
}
/* If no identities, create an initial identity with a phone number.