indices[n++] = session->index;
if (want_token_objects) {
if (!session->loaded)
- p11_token_load (session->token);
- session->loaded = CK_TRUE;
- indices[n++] = p11_token_index (session->token);
+ if (p11_token_load (session->token) < 0)
+ rv = CKR_FUNCTION_FAILED;
+ if (rv == CKR_OK) {
+ session->loaded = CK_TRUE;
+ indices[n++] = p11_token_index (session->token);
+ }
}
+ }
+ if (rv == CKR_OK) {
find = calloc (1, sizeof (FindObjects));
warn_if_fail (find != NULL);
default:
p11_debug ("failed to parse: %s", filename);
loader_gone_file (token, filename);
- return 0;
+ return -1;
}
/* Update each parsed object with the origin */
parsed = p11_parser_parsed (token->parser);
for (i = 0; i < parsed->num; i++) {
parsed->elem[i] = p11_attrs_build (parsed->elem[i], origin, NULL);
- return_val_if_fail (parsed->elem[i] != NULL, 0);
+ return_val_if_fail (parsed->elem[i] != NULL, -1);
}
p11_index_load (token->index);
if (rv != CKR_OK) {
p11_message ("couldn't load file into objects: %s", filename);
- return 0;
+ return -1;
}
loader_was_loaded (token, filename, sb);