Skip to content

Commit

Permalink
Don't bomb out when using keylocation=file://
Browse files Browse the repository at this point in the history
Avoid following the error path when the operation in fact succeeded.

Reviewed-by: Ryan Moeller <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: James Wah <[email protected]>
Closes #11651
  • Loading branch information
abrasive authored Mar 3, 2021
1 parent e439ee8 commit 92fb29b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/libzfs/libzfs_crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,8 @@ get_key_material(libzfs_handle_t *hdl, boolean_t do_verify, boolean_t newkey,

break;
case ZFS_KEYLOCATION_URI:
ret = ENOTSUP;

for (handler = uri_handlers; handler->zuh_scheme != NULL;
handler++) {
if (strcmp(handler->zuh_scheme, uri_scheme) != 0)
Expand All @@ -544,9 +546,11 @@ get_key_material(libzfs_handle_t *hdl, boolean_t do_verify, boolean_t newkey,
break;
}

ret = ENOTSUP;
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"URI scheme is not supported"));
if (ret == ENOTSUP) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"URI scheme is not supported"));
goto error;
}

break;
default:
Expand Down

0 comments on commit 92fb29b

Please sign in to comment.