From 921aa298a647028e95a4f7aa7c1cdd12a1151f75 Mon Sep 17 00:00:00 2001 From: Zoltan Fridrich Date: Fri, 22 Sep 2023 11:08:47 +0200 Subject: [PATCH] p11-kit tool: make "no matching object/token" error user friendly Signed-off-by: Zoltan Fridrich --- p11-kit/add-profile.c | 5 ++--- p11-kit/delete-object.c | 5 ++--- p11-kit/generate-keypair.c | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/p11-kit/add-profile.c b/p11-kit/add-profile.c index 312556be..0880ec1c 100644 --- a/p11-kit/add-profile.c +++ b/p11-kit/add-profile.c @@ -106,9 +106,8 @@ add_profile (const char *token_str, } p11_kit_iter_begin (iter, modules); - rv = p11_kit_iter_next (iter); - if (rv != CKR_OK) { - p11_message (_("failed to find the token: %s"), p11_kit_strerror (rv)); + if (p11_kit_iter_next (iter) != CKR_OK) { + p11_message (_("no matching token")); goto cleanup; } diff --git a/p11-kit/delete-object.c b/p11-kit/delete-object.c index 598f32b7..86536d14 100644 --- a/p11-kit/delete-object.c +++ b/p11-kit/delete-object.c @@ -88,9 +88,8 @@ delete_object (const char *token_str) } p11_kit_iter_begin (iter, modules); - rv = p11_kit_iter_next (iter); - if (rv != CKR_OK) { - p11_message (_("failed to find the object: %s"), p11_kit_strerror (rv)); + if (p11_kit_iter_next (iter) != CKR_OK) { + p11_message (_("no matching object")); goto cleanup; } diff --git a/p11-kit/generate-keypair.c b/p11-kit/generate-keypair.c index d5058a50..a6c3eaf8 100644 --- a/p11-kit/generate-keypair.c +++ b/p11-kit/generate-keypair.c @@ -290,9 +290,8 @@ generate_keypair (const char *token_str, } p11_kit_iter_begin (iter, modules); - rv = p11_kit_iter_next (iter); - if (rv != CKR_OK) { - p11_message (_("failed to find the token: %s"), p11_kit_strerror (rv)); + if (p11_kit_iter_next (iter) != CKR_OK) { + p11_message (_("no matching token")); goto cleanup; }