diff --git a/p11-kit/add-profile.c b/p11-kit/add-profile.c index fb583c38..69047654 100644 --- a/p11-kit/add-profile.c +++ b/p11-kit/add-profile.c @@ -108,7 +108,10 @@ 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 (rv == CKR_CANCEL) + p11_message (_("no matching token")); + else + p11_message (_("failed to find token: %s"), p11_kit_strerror (rv)); goto cleanup; } diff --git a/p11-kit/delete-object.c b/p11-kit/delete-object.c index 598f32b7..5bea952d 100644 --- a/p11-kit/delete-object.c +++ b/p11-kit/delete-object.c @@ -90,7 +90,10 @@ 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 (rv == CKR_CANCEL) + p11_message (_("no matching object")); + else + p11_message (_("failed to find object: %s"), p11_kit_strerror (rv)); goto cleanup; } diff --git a/p11-kit/generate-keypair.c b/p11-kit/generate-keypair.c index d3249457..20ead0e6 100644 --- a/p11-kit/generate-keypair.c +++ b/p11-kit/generate-keypair.c @@ -292,7 +292,10 @@ 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 (rv == CKR_CANCEL) + p11_message (_("no matching token")); + else + p11_message (_("failed to find token: %s"), p11_kit_strerror (rv)); goto cleanup; }