X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcryptsetup.c;h=f52a41b995dbe8ca4bbf253daa72ef589eea5b57;hb=4fe60156fc45e34c7bcba4779123e15620532dff;hp=989734be1bc44badb3ca130ea14daaece34d1afd;hpb=dd5e696d93f70bbfaf8423682e7731fefa83f828;p=elogind.git diff --git a/src/cryptsetup.c b/src/cryptsetup.c index 989734be1..f52a41b99 100644 --- a/src/cryptsetup.c +++ b/src/cryptsetup.c @@ -31,6 +31,7 @@ #include "util.h" #include "strv.h" #include "ask-password-api.h" +#include "def.h" static const char *opt_type = NULL; /* LUKS1 or PLAIN */ static char *opt_cipher = NULL; @@ -308,7 +309,10 @@ int main(int argc, char *argv[]) { if (opt_readonly) flags |= CRYPT_ACTIVATE_READONLY; - until = now(CLOCK_MONOTONIC) + (opt_timeout > 0 ? opt_timeout : 60 * USEC_PER_SEC); + if (opt_timeout > 0) + until = now(CLOCK_MONOTONIC) + opt_timeout; + else + until = 0; opt_tries = opt_tries > 0 ? opt_tries : 3; opt_key_size = (opt_key_size > 0 ? opt_key_size : 256); @@ -403,6 +407,8 @@ int main(int argc, char *argv[]) { } } + k = 0; + if (!opt_type || streq(opt_type, CRYPT_LUKS1)) k = crypt_load(cd, CRYPT_LUKS1, NULL);