summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Soutar <andrew@andrewsoutar.com>2017-07-31 02:19:16 -0400
committerMartin Pitt <martinpitt@users.noreply.github.com>2017-07-31 08:19:16 +0200
commit0864d311766498563331f486909a0d950ba7de87 (patch)
treeb5542aecf5c15a891c73c1fe0917dc955bc434e7 /src
parent0742986650b36b604613f9aaa1f6bd45b51c0e67 (diff)
downloadsystemd-0864d311766498563331f486909a0d950ba7de87.tar.gz
cryptsetup: fix infinite timeout (#6486)
0004f698d causes `arg_timeout` to be infinity instead of 0 when timeout=0. The logic here now matches this change. Fixes #6381
Diffstat (limited to 'src')
-rw-r--r--src/cryptsetup/cryptsetup.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c
index 3b4c086162..08ed7e53ba 100644
--- a/src/cryptsetup/cryptsetup.c
+++ b/src/cryptsetup/cryptsetup.c
@@ -56,7 +56,7 @@ static bool arg_tcrypt_veracrypt = false;
static char **arg_tcrypt_keyfiles = NULL;
static uint64_t arg_offset = 0;
static uint64_t arg_skip = 0;
-static usec_t arg_timeout = 0;
+static usec_t arg_timeout = USEC_INFINITY;
/* Options Debian's crypttab knows we don't:
@@ -670,10 +670,10 @@ int main(int argc, char *argv[]) {
if (arg_discards)
flags |= CRYPT_ACTIVATE_ALLOW_DISCARDS;
- if (arg_timeout > 0)
- until = now(CLOCK_MONOTONIC) + arg_timeout;
- else
+ if (arg_timeout == USEC_INFINITY)
until = 0;
+ else
+ until = now(CLOCK_MONOTONIC) + arg_timeout;
arg_key_size = (arg_key_size > 0 ? arg_key_size : (256 / 8));