Skip to content

Commit

Permalink
zpool: misc. cleanup
Browse files Browse the repository at this point in the history
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes #12968
  • Loading branch information
nabijaczleweli authored and behlendorf committed Feb 2, 2022
1 parent 0481eab commit a401a2c
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions cmd/zpool/zpool_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3218,11 +3218,9 @@ do_import(nvlist_t *config, const char *newname, const char *mntopts,
* Loading keys is best effort. We don't want to return immediately
* if it fails but we do want to give the error to the caller.
*/
if (flags & ZFS_IMPORT_LOAD_KEYS) {
ret = zfs_crypto_attempt_load_keys(g_zfs, name);
if (ret != 0)
if (flags & ZFS_IMPORT_LOAD_KEYS &&
zfs_crypto_attempt_load_keys(g_zfs, name) != 0)
ret = 1;
}

if (zpool_get_state(zhp) != POOL_STATE_UNAVAIL &&
!(flags & ZFS_IMPORT_ONLY) &&
Expand Down Expand Up @@ -3272,7 +3270,7 @@ import_pools(nvlist_t *pools, nvlist_t *props, char *mntopts, int flags,
if (first)
first = B_FALSE;
else if (!do_all)
(void) printf("\n");
(void) putchar('\n');

if (do_all) {
err |= do_import(config, NULL, mntopts,
Expand Down Expand Up @@ -3723,9 +3721,8 @@ zpool_do_import(int argc, char **argv)
if (argc == 0 && geteuid() != 0) {
(void) fprintf(stderr, gettext("cannot "
"discover pools: permission denied\n"));
if (searchdirs != NULL)
free(searchdirs);

free(searchdirs);
nvlist_free(props);
nvlist_free(policy);
return (1);
Expand Down

0 comments on commit a401a2c

Please sign in to comment.