X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcryptsetup.c;h=4ef9606d39fabc415e003ab0736ab426a9f7618a;hb=7640a5de1b3ffe6547200ad204d14e4f067caf4f;hp=3aa822a1d020591f618e5f6e18b8faab467d65f4;hpb=f6a6225e414858ff222d2b175369cc42459abf9a;p=elogind.git diff --git a/src/cryptsetup.c b/src/cryptsetup.c index 3aa822a1d..4ef9606d3 100644 --- a/src/cryptsetup.c +++ b/src/cryptsetup.c @@ -40,7 +40,7 @@ static char *opt_hash = NULL; static unsigned opt_tries = 0; static bool opt_readonly = false; static bool opt_verify = false; -static usec_t opt_timeout = 0; +static usec_t opt_timeout = DEFAULT_TIMEOUT_USEC; /* Options Debian's crypttab knows we don't: @@ -309,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 : DEFAULT_TIMEOUT_USEC); + 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); @@ -404,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);