Skip to content

Commit

Permalink
Small error message fixups
Browse files Browse the repository at this point in the history
Signed-off-by: Zoltan Fridrich <[email protected]>
  • Loading branch information
ZoltanFridrich committed Sep 21, 2023
1 parent 79fe36c commit 0a11e88
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 21 deletions.
8 changes: 4 additions & 4 deletions p11-kit/add-profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ profile_exists (CK_FUNCTION_LIST *module,
while ((rv = p11_kit_iter_next (iter)) == CKR_OK) {
rv = p11_kit_iter_get_attributes (iter, &attr, 1);
if (rv != CKR_OK) {
p11_message (_("failed to retrieve attribute of an object"));
p11_message (_("failed to retrieve attribute of an object: %s"), p11_kit_strerror (rv));
p11_kit_iter_free (iter);
return false;
}
Expand Down Expand Up @@ -118,12 +118,12 @@ add_profile (const char *token_str,

uri = p11_kit_uri_new ();
if (uri == NULL) {
p11_message (_("failed to allocate memory for URI"));
p11_message (_("failed to allocate memory"));
goto cleanup;
}

if (p11_kit_uri_parse (token_str, P11_KIT_URI_FOR_TOKEN, uri) != P11_KIT_URI_OK) {
p11_message (_("failed to parse the token URI"));
p11_message (_("failed to parse URI"));
goto cleanup;
}

Expand All @@ -150,7 +150,7 @@ add_profile (const char *token_str,
session = p11_kit_iter_get_session (iter);
rv = module->C_CreateObject (session, template, template_len, &object);
if (rv != CKR_OK) {
p11_message (_("failed to create the profile object: %s"), p11_kit_strerror (rv));
p11_message (_("failed to create profile object: %s"), p11_kit_strerror (rv));
goto cleanup;
}

Expand Down
4 changes: 2 additions & 2 deletions p11-kit/delete-object.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ delete_object (const char *token_str)

uri = p11_kit_uri_new ();
if (uri == NULL) {
p11_message (_("failed to allocate memory for URI"));
p11_message (_("failed to allocate memory"));
goto cleanup;
}

if (p11_kit_uri_parse (token_str, P11_KIT_URI_FOR_OBJECT_ON_TOKEN, uri) != P11_KIT_URI_OK) {
p11_message (_("failed to parse the token URI"));
p11_message (_("failed to parse URI"));
goto cleanup;
}

Expand Down
8 changes: 4 additions & 4 deletions p11-kit/delete-profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ delete_profile (const char *token_str,

uri = p11_kit_uri_new ();
if (uri == NULL) {
p11_message (_("failed to allocate memory for URI"));
p11_message (_("failed to allocate memory"));
goto cleanup;
}

if (p11_kit_uri_parse (token_str, P11_KIT_URI_FOR_OBJECT_ON_TOKEN, uri) != P11_KIT_URI_OK) {
p11_message (_("failed to parse the token URI"));
p11_message (_("failed to parse URI"));
goto cleanup;
}

Expand All @@ -99,14 +99,14 @@ delete_profile (const char *token_str,
while ((rv = p11_kit_iter_next (iter)) == CKR_OK) {
rv = p11_kit_iter_get_attributes (iter, &attr, 1);
if (rv != CKR_OK) {
p11_message (_("failed to retrieve attribute of an object"));
p11_message (_("failed to retrieve attribute of an object: %s"), p11_kit_strerror (rv));
goto cleanup;
}

if (profile_id == profile) {
rv = p11_kit_iter_destroy_object (iter);
if (rv != CKR_OK)
p11_message (_("failed to delete the profile"));
p11_message (_("failed to delete profile: %s"), p11_kit_strerror (rv));
}
}

Expand Down
4 changes: 2 additions & 2 deletions p11-kit/export-object.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ export_object (const char *token_str)

uri = p11_kit_uri_new ();
if (uri == NULL) {
p11_message (_("failed to allocate memory for URI"));
p11_message (_("failed to allocate memory"));
goto cleanup;
}

if (p11_kit_uri_parse (token_str, P11_KIT_URI_FOR_OBJECT_ON_TOKEN, uri) != P11_KIT_URI_OK) {
p11_message (_("failed to parse the token URI"));
p11_message (_("failed to parse URI"));
goto cleanup;
}

Expand Down
4 changes: 2 additions & 2 deletions p11-kit/generate-keypair.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,12 @@ generate_keypair (const char *token_str,

uri = p11_kit_uri_new ();
if (uri == NULL) {
p11_message (_("failed to allocate memory for URI"));
p11_message (_("failed to allocate memory"));
goto cleanup;
}

if (p11_kit_uri_parse (token_str, P11_KIT_URI_FOR_TOKEN, uri) != P11_KIT_URI_OK) {
p11_message (_("failed to parse the token URI"));
p11_message (_("failed to parse URI"));
goto cleanup;
}

Expand Down
6 changes: 3 additions & 3 deletions p11-kit/list-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ get_object_uri (P11KitIter *iter,

uri = p11_kit_uri_new ();
if (uri == NULL) {
p11_message (_("failed to allocate memory for URI"));
p11_message (_("failed to allocate memory"));
return NULL;
}

Expand Down Expand Up @@ -345,12 +345,12 @@ list_objects (const char *token_str)

uri = p11_kit_uri_new ();
if (uri == NULL) {
p11_message (_("failed to allocate memory for URI"));
p11_message (_("failed to allocate memory"));
goto cleanup;
}

if (p11_kit_uri_parse (token_str, P11_KIT_URI_FOR_OBJECT_ON_TOKEN, uri) != P11_KIT_URI_OK) {
p11_message (_("failed to parse the token URI"));
p11_message (_("failed to parse URI"));
goto cleanup;
}

Expand Down
7 changes: 3 additions & 4 deletions p11-kit/list-profiles.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>

#ifdef ENABLE_NLS
#include <libintl.h>
Expand Down Expand Up @@ -73,12 +72,12 @@ list_profiles (const char *token_str)

uri = p11_kit_uri_new ();
if (uri == NULL) {
p11_message (_("failed to allocate memory for URI"));
p11_message (_("failed to allocate memory"));
goto cleanup;
}

if (p11_kit_uri_parse (token_str, P11_KIT_URI_FOR_OBJECT_ON_TOKEN, uri) != P11_KIT_URI_OK) {
p11_message (_("failed to parse the token URI"));
p11_message (_("failed to parse URI"));
goto cleanup;
}

Expand All @@ -99,7 +98,7 @@ list_profiles (const char *token_str)
while ((rv = p11_kit_iter_next (iter)) == CKR_OK) {
rv = p11_kit_iter_get_attributes (iter, &attr, 1);
if (rv != CKR_OK) {
p11_message (_("failed to retrieve attribute of an object"));
p11_message (_("failed to retrieve attribute of an object: %s"), p11_kit_strerror (rv));
goto cleanup;
}

Expand Down

0 comments on commit 0a11e88

Please sign in to comment.