]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
cryptsetup: fix infinite timeout (#6486)
authorAndrew Soutar <andrew@andrewsoutar.com>
Mon, 31 Jul 2017 06:19:16 +0000 (02:19 -0400)
committerMartin Pitt <martinpitt@users.noreply.github.com>
Mon, 31 Jul 2017 06:19:16 +0000 (08:19 +0200)
0004f698d causes `arg_timeout` to be infinity instead of 0 when timeout=0. The
logic here now matches this change.

Fixes #6381

src/cryptsetup/cryptsetup.c

index 3b4c086162d0bee2020e8116517dd12eedbd0837..08ed7e53ba33355ccc6095facd4292d3329523d4 100644 (file)
@@ -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));