Allow to specify --align-payload only for luksFormat.

This commit is contained in:
Milan Broz
2012-04-02 21:23:44 +02:00
parent bd047d03ef
commit 2499fa669d
2 changed files with 6 additions and 0 deletions

View File

@@ -1443,6 +1443,7 @@ int main(int argc, const char **argv)
if (opt_random && opt_urandom)
usage(popt_context, EXIT_FAILURE, _("Only one of --use-[u]random options is allowed."),
poptGetInvocationName(popt_context));
if ((opt_random || opt_urandom) && strcmp(aname, "luksFormat"))
usage(popt_context, EXIT_FAILURE, _("Option --use-[u]random is allowed only for luksFormat."),
poptGetInvocationName(popt_context));
@@ -1451,6 +1452,10 @@ int main(int argc, const char **argv)
usage(popt_context, EXIT_FAILURE, _("Option --uuid is allowed only for luksFormat and luksUUID."),
poptGetInvocationName(popt_context));
if (opt_align_payload && strcmp(aname, "luksFormat"))
usage(popt_context, EXIT_FAILURE, _("Option --align-payload is allowed only for luksFormat."),
poptGetInvocationName(popt_context));
if (opt_skip && strcmp(aname, "create") && strcmp(aname, "loopaesOpen"))
usage(popt_context, EXIT_FAILURE,
_("Option --skip is supported only for create and loopaesOpen commands.\n"),