Fix luksKillSLot exit code if slot is inactive or invalid. (Issue 108)

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@624 36d66b0a-2a48-0410-832c-cd162a569da5
This commit is contained in:
Milan Broz
2011-10-09 13:46:03 +00:00
parent 8c54d938ac
commit cc3b39980b
3 changed files with 5 additions and 1 deletions

View File

@@ -646,6 +646,7 @@ static int action_luksKillSlot(int arg __attribute__((unused)))
case CRYPT_SLOT_INACTIVE:
log_err(_("Key %d not active. Can't wipe.\n"), opt_key_slot);
case CRYPT_SLOT_INVALID:
r = -EINVAL;
goto out;
}
@@ -1301,7 +1302,7 @@ int main(int argc, const char **argv)
if (!strcmp(aname, "luksKillSlot") && action_argc > 1)
opt_key_slot = atoi(action_argv[1]);
if (opt_key_slot != CRYPT_ANY_SLOT &&
(opt_key_slot < 0 || opt_key_slot > crypt_keyslot_max(CRYPT_LUKS1)))
(opt_key_slot < 0 || opt_key_slot >= crypt_keyslot_max(CRYPT_LUKS1)))
usage(popt_context, EXIT_FAILURE, _("Key slot is invalid."),
poptGetInvocationName(popt_context));